rocketTendon
asked on
RewriteCond for returning a 403?
What would the RewriteCond look like if I wanted to return a 403 to the client for all .html and .htm files requested?
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
I like to add 1 more thing as the original OP stated his problem wasn't actually solved.
I made a small mistake in my RewriteRule:
Options +FollowSymLinks ##use SymLinks pls (this is best on when using the RewriteEngine)
RewriteEngine On ##puts the Rewrite Engine On, obviously
RewriteCond %{REQUEST_FILENAME} *\.htm* ##this checks for any *.htm* file (catching *.html on the way)
RewriteRule ^/$ / [F] ##rewrite the complete URL to the base url (/); F stands for forbidden (403) (the L in my first reply was for Last command, obviously in the wrong place and not needed)
You could write the RewriteRule also as:
RewriteRule .* - [F]
which is another way of using the wildcards.
I made a small mistake in my RewriteRule:
Options +FollowSymLinks ##use SymLinks pls (this is best on when using the RewriteEngine)
RewriteEngine On ##puts the Rewrite Engine On, obviously
RewriteCond %{REQUEST_FILENAME} *\.htm* ##this checks for any *.htm* file (catching *.html on the way)
RewriteRule ^/$ / [F] ##rewrite the complete URL to the base url (/); F stands for forbidden (403) (the L in my first reply was for Last command, obviously in the wrong place and not needed)
You could write the RewriteRule also as:
RewriteRule .* - [F]
which is another way of using the wildcards.
ASKER
I am still getting a 404 error for html files after I add that code.