1

I have a clean installation of Apache+PHP (latest) on CentOS 8 with no customization on php.ini nor .htaccess files. For some reason when I open URLs like:

https://www.example.com/index.php/xxxx/flkjfd.jpg
https://www.example.com/index.php/SLkfjLj/
https://www.example.com/index.php/9kf944.994

They always show the content of the index.php file located at the root. If I remove that file, than the URLs above show 404 error. How can this happen? I have no directory "index.php"! I have only a file "index.php" with some random string... How can I prevent this?

Isnt this weird? Or is this expected?

RavinderSingh13
  • 130,504
  • 14
  • 57
  • 93
Jonathan
  • 117
  • 1
  • 7
  • What does your .htaccess file look like? – John Glenn Jan 31 '22 at 04:04
  • If you try navigating to some non-existent URL - without deleting index.php - do you get a 404 or redirected to index? – John Glenn Jan 31 '22 at 04:05
  • I have no .htaccess file. I didnt understand the "non-existent URL". I have absolutely no other file in my server (other than the index.php file) and any path that I use in the URL it opens the index.php file. – Jonathan Jan 31 '22 at 17:42
  • 1
    Does this answer your question? [How does Apache handle index.php/some\_text webpage requests? It returns http status 200 instead of expected 404](https://stackoverflow.com/questions/70369041/how-does-apache-handle-index-php-some-text-webpage-requests-it-returns-http-sta) – MrWhite Feb 02 '22 at 11:20
  • Yes, this is expected (default) behaviour. The part after a valid _file_ (eg. `/xxxx/flkjfd.jpg`) is called "path-info". See the above question which explains more and how to prevent this. – MrWhite Feb 02 '22 at 11:22

0 Answers0