Last active
August 9, 2017 09:22
-
-
Save chris-carneiro/b74c433841b1afbeaa45e00be9c3da12 to your computer and use it in GitHub Desktop.
.htaccess that makes apache return "not found" for requests that either lead to a 404 or 403.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
ErrorDocument 404 "Not found" Or http://yourdomain.com ## Redirects 404 Error to home page | |
RewriteEngine On | |
RewriteBase / | |
RewriteRule ^(.*)/(.*)$ - [R=404,L] ## Returns Error 404 when trying to access a subfolder | |
## Returns 404 when trying to access the current .htaccess file | |
RewriteCond %{THE_REQUEST} ^[A-Z]{3,9}\ /.*\.(htpasswd|htaccess|aahtpasswd).*\ HTTP/ [NC] | |
RewriteRule .? - [R=404,NS,L] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment