I have a website say abc.com ,when I enter a wrong address like abc.com/somthing.php it shows a 404 not found but when I enter the address like abc.com/index.php/something.php it does not show the 404 error. Any suggestions?
I have a website say abc.com ,when I enter a wrong address like abc.com/somthing.php it shows a 404 not found but when I enter the address like abc.com/index.php/something.php it does not show the 404 error. Any suggestions?
2
Answers
The request
gives you 404 because something.php file does not exist on the server.
On the other hand, the request
gives you 404 only if index.php does not exist on the server. If
abc.com/index.php
resides on the server, then it is accessed and the string/something.php
is actually treated as a variable, that can be read with the$_SERVER['PATH_INFO']
.If your
index.php
file looks like thisand you access it using
abc.com/index.php/something.php
then the output will look likesomething.php
.For further info, feel free to check the documentation
https://www.digitalocean.com/community/tutorials/how-to-create-a-custom-404-page-in-apache
This should help
Keep in mind that the Apache looks for the 404 page located within the site’s server root. Meaning that if you place the new error page in a deeper subdirectory, you need to include that in the line, making into something like this: