: Is my .htaccess rule creating an infinite loop? Whenever I type a made up address that includes a directory index it removes it. The problem is when the the address includes a forbidden subdirectory.
Whenever I type a made up address that includes a directory index it removes it. The problem is when the the address includes a forbidden subdirectory. It reduces itself until it hits forbidden. How do I get it to redirect to the homepage instead of reducing itself?
Options -Indexes +FollowSymlinks -MultiViews
RewriteEngine on
DirectoryIndex index.htm index.html index.php
# REDIRECT www to non-wwww
# Set Canonical URL
RewriteCond %{HTTP_HOST} !^www.
RewriteRule ^(.*)$ www.%{HTTP_HOST}/ [R=301,L]
# REMOVE Directory Index From URL
RewriteRule ^([a-zA-Z0-9_-]+/)?index.(htm?|html?)$ / [R=301,L]
# Custom Error Documents
ErrorDocument 404 /errors/404_notfound.htm
More posts by @Margaret670
Terms of Use Create Support ticket Your support tickets Stock Market News! © vmapp.org2024 All Rights reserved.