Forum Moderators: phranque
I am trying to invoke HTTP 404 using an internal rewrite (with Apache 1.3.34 mod_rewrite) to a non-existent page. The problem is, however, that it works only in one particular folder on my site. In all other folders (including the site root), Apache does full external redirection, so it the server actually does a 301 redirection followed by 404, and the visitor can see the non-existent URL in his browser.
AllowOverride None
Options FollowSymLinksIndexIgnore .htaccess */.?* *~ *#
RewriteEngine On
# This does not work
RewriteCond %{HTTPS} ^off$ [NC]
RewriteCond %{REQUEST_URI} \.[^/]+/
RewriteRule .* /invoke404 [L]# This one actually works
RewriteCond %{REQUEST_URI} ^/legal/.+$
RewriteCond %{REQUEST_URI} !\.
RewriteRule (.*)/legal/(.*) $1/legal/$2\.invoke404 [L]# ...
ErrorDocument 404 /custom_404_error_page.php
What could be the cause?
Thanks.
[edited by: Lenni at 11:03 pm (utc) on May 6, 2008]
Anyway, I found a workaround. Here it is, in case anyone needs it. Simply rewrite to a non-existing file in a non-existing or existing folder (if it's not in a folder but in site root, the bug will occur).
RewriteRule .* /non-existent/non-existent-file
[edited by: Lenni at 8:31 am (utc) on May 7, 2008]
I even tried deleting all the custom error pages, to no avail. Does anyone know any solution?