Hi, I have removed the link 'CHAPTER<num>' from my web page. Now I wanted to create a immediate 404 page not found rule for all the requests for this link e.g chapter1 should give 404 chapter2 sould give 404 and so on.. any idea?
Thanks for your reply. Since it is not a single file I can not specify the way as you said. I have several pages to redirect to 404, as below is there anyway to use regular expression for that?
If I understand your problem correctly, I think what you need is rather a 301 redirect. Assuming you have access to your .htaccess file, something like this:
you are right. Normally we will use 301 for this and for me 301 is working fine. But specifically I need a 404 in this situation, hence I opened this thread.
I assume you will have possibilty to execute php files on the given webserver, so I suggest to create a check404.php file with the following content. <?php if (preg_match("/chapter/i", $_SERVER['REQUEST_URI']) { header("HTTP/1.0 404 Not Found");} ?> PHP: This will execute a search in the requested URI and when a match occures in accordance with the patter it will give 404 response. In order to make this script execute before every request insert this code to your .htaccess file php_value auto_prepend_file "/www/htdocs/yoursite/check404.php" Code (markup):