redirecting directory browse attempt to homepage
-
Hello
I am wishing to polish off a .htaccess file that I found with redirections to my homepage, so that if an directory such as mysite.com/wordpress/wp-includes is browsed, rather than seeing a 403 error, the browser is directed to the home page at mysite.com
I find this to be a more desirable action over the ‘Silence is Golden’ index.php in every open directory. Is there any reason this is not a good idea?
This is the contents of my current .htaccess file:
# protect the htaccess file <files .htaccess> order allow,deny deny from all </files> # disable the server signature ServerSignature Off # limit file uploads to 50mb LimitRequestBody 54000000 # protect wpconfig.php <files wp-config.php> order allow,deny deny from all </files> #who has access who doesnt order allow,deny #deny from 000.000.000.000 allow from all #custom error docs #ErrorDocument 404 /notfound.php #ErrorDocument 403 /forbidden.php #ErrorDocument 500 /error.php # disable directory browsing Options All -Indexes #redirect old to new Redirect 301 /wordpress/index.php https://www.mysite.com #block referring domains #RewriteEngine on #RewriteCond %{HTTP_REFERER} digg\.com [NC] #RewriteRule .* – [F] #disable hotlinking of images with forbidden or custom image option RewriteEngine on RewriteCond %{HTTP_REFERER} !^$ RewriteCond %{HTTP_REFERER} !^https://(www\.)?mysite.com/.*$ [NC] #RewriteRule \.(gif|jpg)$ – [F] #RewriteRule \.(gif|jpg)$ https://mysite.com [R,L] # php compression – use with caution #<ifmodule mod_php4.c> #php_value zlib.output_compression 16386 #</ifmodule> # set the canonical url RewriteEngine On RewriteCond %{HTTP_HOST} ^mysite\.com$ [NC] RewriteRule ^(.*)$ https://mysite.com/$1 [R=301,L] # protect from spam comments #RewriteEngine On #RewriteCond %{REQUEST_METHOD} POST #RewriteCond %{REQUEST_URI} .wp-comments-post\.php* #RewriteCond %{HTTP_REFERER} !.*mysite.com.* [OR] #RewriteCond %{HTTP_USER_AGENT} ^$ #RewriteRule (.*) ^https://%{REMOTE_ADDR}/$ [R=301,L]
Thanks in advance
- The topic ‘redirecting directory browse attempt to homepage’ is closed to new replies.