Revious
Revious

Reputation: 8156

Finding the php file which is executed (the name is hidden by .htaccess)

I've a very weird situation on my own website.

When I try to execute this page: http://www.****.com/Militari/Guida-scelta-.htm Or this page http://www.****.com/Militari/Guida-.htm

I get the same result. Looking to the .htaccess/PHP files it's a completely unpredictable result.

It looks like if the executed php file would make a DB search and try to find the best matching result.

This is on a shared hosting. How can I find which PHP file is being executed?

The .htaccess

RewriteEngine on 
RewriteRule ^Cinema/Interviste/([^/]*)\.htm$ /Cinema/Interviste/film.php?title=$1
RewriteRule ^Cinema/dvd/([^/]*)\.htm$ /Cinema/dvd/film.php?title=$1
RewriteRule ^Cinema/([^/]*)\.htm$ /Cinema/film.php?title=$1
RewriteRule ^Attori/(.*)\.htm$ Attore.php?name=$1
RewriteRule ^Registi/(.*)\.htm$ Regista.php?regia=$1
RewriteRule ^(.*)\.htm $1\.php
RewriteRule filmrecensiti\.xml filmrecensiti\.xml\.php
RewriteRule filmrecensiti2\.xml filmrecensiti2_old\.xml
RewriteRule ^Elenco\sFilm\s(.)\.php Elenco_Film_Recensiti\.php?starting_letter=$1
RewriteRule ^Elenco\sFilm\sRecensiti(.*) Elenco_Film_Recensiti$1
RewriteRule ^(.*)\.js php_js\.php\?id=$1\.js
RewriteRule ^(.*)\.css php_css\.php\?id=$1\.css
#RewriteRule ^feeds/(.+)$ feeds_items/$1 [L]
ErrorDocument 400 /not_found.htm
ErrorDocument 401 /not_found.htm
ErrorDocument 403 /not_found.htm
ErrorDocument 404 /not_found.htm
ErrorDocument 500 /not_found.htm

EDIT

I had missed the .htaccess in the subfolder

its content is

RewriteRule ^([^/]*)\.htm$ film.php?title=$1

I found the problem thanks to your advice.

This helped a lot: $_SERVER['PHP_SELF'] or $_SERVER['SCRIPT_NAME']

Upvotes: 0

Views: 50

Answers (1)

miken32
miken32

Reputation: 42720

From what you've posted, the only applicable rule would be RewriteRule ^(.*)\.htm $1\.php suggesting that http://www.****.com/Militari/Guida-scelta-.htm would actually serve up http://www.****.com/Militari/Guida-scelta-.php.

Upvotes: 1

Related Questions