ErrorDocument 404 don't work together with RewriteRule

63 Views Asked by At

I have a rewriterule as

RewriteRule ^item/([0-9a-zA-Z_-]+)$ description.php?article=$1 [L,QSA]

in order to rewrite description.php?a=1&b=2&c=3 to item/xxxx-xxx-xxx-xxx

This works fine but then I try to add ErrorDocument 404.

If a item can't be find, I use header as

header($_SERVER["SERVER_PROTOCOL"]." 404 Not Found");
exit();

which works really well. The problem is that I want to add

ErrorDocument 404 https://www.homepage.com/404.html

but the page is not showing up. I don't get any other errors such as 500 Internal error, it is just the default 404 page.

If I excluded the rewriterule, ErrorDocument 404 works fine.

Is there any solution for this?

0

There are 0 best solutions below