How to disable directory listing in Wordpress

Asked

Viewed 260 times

2

Good afternoon everyone, I would like my directory listing not to be exposed, I used the following code within the .htaccess Options -Indexes, but when I test the code by renaming the index php. he returns error 403. It is possible to present another error screen or have another way to perform this process?

2 answers

1

Guys, after some researches I found a way not to show my directory, follow the step by step:

//I directed the error to an image, where it indicates site in maintenance, and used the code below to check//

ErrorDocument 403 /site_em_manutencao.png

<IfModule mod_rewrite.c>
    RewriteEngine On
    RewriteBase /
    RewriteRule ^(index|index/)$ index.php [NC,L]
    RewriteRule ^index/([a-z0-9-]+)$ index.php/$1 [NC]
</IfModule>

0


I’m no expert, and I don’t know if that’s exactly the answer you want, but I’ll give you some tips on what I’ve seen.

First in robots.txt from your site disable the directories so that they do not appear in search engines, see the example: (the name of the directories will depend on what you have at the root)

User-agent: *
Disallow: /administrator/
Disallow: /administrator
Disallow: /cache/
Disallow: /cli/
Disallow: /components/
Disallow: /images/
Disallow: /includes/
Disallow: /installation/
Disallow: /language/
Disallow: /libraries/
Disallow: /logs/
Disallow: /media/
Disallow: /modules/
Disallow: /plugins/
Disallow: /templates/
Disallow: /tmp/

Then create a file index.html blank at the root of each of these directories, so if someone tries to enter straight through the folder path will fall on a blank page...

<!DOCTYPE html>
<html lang="en">
<head>
    <title>Document</title>
</head>
<body></body>
</html>

And lastly, try to "mask" that vc is using Wordpress, remove or rename the codes you have written Wordpress, for example to <meta name="generator" content="WordPress.com" /> in the contente put your company name.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.