hankknight
asked on
Send 404 header even if page exists
Hello,
I have a page:
http://www.example.com/404/
or
http://www.example.com/404/index.htm
I want to send a 404 header every time the page is accessed even though the page does exsist. I do not have access to httpd.conf but I do have support for custom .htaccess commands.
I have a page:
http://www.example.com/404/
or
http://www.example.com/404/index.htm
I want to send a 404 header every time the page is accessed even though the page does exsist. I do not have access to httpd.conf but I do have support for custom .htaccess commands.
ASKER
php is not an option for this project.
So none of your ideas will catch a direct hit for the 404 page?
Maybe the best way would be to create a 404 page at:
/404/adfdasasdfadsfasdffda sfdsfdsfda sf.htm
And then this in .htaccess?
Would that work?
So none of your ideas will catch a direct hit for the 404 page?
Maybe the best way would be to create a 404 page at:
/404/adfdasasdfadsfasdffda
And then this in .htaccess?
Would that work?
Options +FollowSymlinks
RewriteEngine On
RewriteRule ^404($|/) [LR=404]
RewriteRule ^hideThisDir($|/) 404/index.htm [LR=404]
ErrorDocument 404 /404/adfdasasdfadsfasdffdasfdsfdsfdasf.htm
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Change your RewriteRules into
RewriteRule ^... - [R=404]
with
ErrorDocument 404 /404.html
present.
Prior apache 2.2:
RewriteRule ^... /nonexistant [L]
ErrorDocument 404 /404.html
but both cases won't catch a direct request of /404.htm.
Open in new window