• Resolved cristiansans

    (@cristiansans)


    hi,

    i’ve just been playin g the whole day with the .htaccess file to get the most accurate configuration. my goal is to block the access to the wp-content folder from the browser.

    i’m not so familiar with rewrite rules and i’m not so happy with the result, i think that i can be done in a cleanest way,

    Actually i added a blank index.php files to any folder inside wp-content and write a rule for any of the folders that looks like this:

    Redirect 301 /wp-content/index.php https://mydomain.com/

    I think that this can be done in a better way because this solution doesn’t cover the full access to the folders. And when I tried to aply te rule directly to the folder, as you can imagine, some of the plugins that i’m using or even the upload module stop to run because the server is redirecting any request to this folder.

    I was just wondering if someone can point me in the right way.

    Thanx!

Viewing 6 replies - 1 through 6 (of 6 total)
  • you cant do that, for reasons you just discovered. Your themes live inside there, your plugins live inside there.

    You can prevent files that live inside those directories from being called directly — but it would take editing every file individually.

    You can prevent those directories from being browsable by insuring that you are using Options All -Indexes in your .htaccess — You can combine that with an index.html, if you like, inside each directory.

    Keep in mind, putting an index.php inside your wp-content/plugins directory will cause issues with your dashboard. Thats why I said index.html.

    Thread Starter cristiansans

    (@cristiansans)

    ok I understand i’m going to update my .htaccess and change the .php files for a html ones.

    very helpful!

    Thread Starter cristiansans

    (@cristiansans)

    Just to confirm that is running.

    thanx!

    whats running? ??

    Michael Torbert

    (@hallsofmontezuma)

    WordPress Virtuoso

    lol

    Thread Starter cristiansans

    (@cristiansans)

    yeyeye lol i just added the -Indexes rule.

    how i should do to instead to redirect the content to the main page give the error 404 page?

Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘using htaccess to restrict wp-content access from the browser’ is closed to new replies.