Skip to content
Advertisement

Current setting up for apache/php will always return a 200 page instead of 404

UPDATE: I added a 404 error document:

JavaScript

But nothing has changed.

I have a problem with an apache snippet:

JavaScript

in

JavaScript

I created to obtain an URL like this:

JavaScript

And I called my PHP file like this:

JavaScript

This because I have different languages.

now, that’s my PHP file to display them:

JavaScript

Where languages variable is:

JavaScript

Now, this won’t return a 404 page for some reason and will return only a 200 header response.

I’m wondering if anyone has experience in setting up a 404-page system, I read a lot of tutorials but none of them gave me a satisfying answer.

Thank you in advance

Advertisement

Answer

The rewrite rule matches on all routes. There’s no way that Apache can throw a 404 error, as it does not know what your application is doing.

You need to check whether such an error should be thrown in your application itself, within PHP code. If the files within the subfolders are the proper condition for this, you could write:

JavaScript
User contributions licensed under: CC BY-SA
4 People found this is helpful
Advertisement