Page 1 of 1

My PHP files can be accessed without adding .php. How?

Posted: Sat Feb 03, 2007 3:36 pm
by The Bat
If I had a PHP script named hello.php, I can access it without adding .php, like so: http://127.0.0.1/hello

I assume this has something to do in my httpd.conf file, but exactly what part of it makes Apache do this?

Posted: Sat Feb 03, 2007 3:59 pm
by Ollie Saunders
I think it could be a number of things - mod_rewrite is the most likely culprit.
Post your config.

Posted: Sat Feb 03, 2007 6:57 pm
by AKA Panama Jack
Actually if you enable "MultiViews" in the apache configuration file your PHP files can be accessed without the use of the .php.

Code: Select all

<Directory />
	Options Indexes FollowSymLinks Includes ExecCGI MultiViews
	AllowOverride None
	Order deny,allow
	Deny from all
</Directory>
Remove MultiViews from any Alias or Directory blocks in the http.conf and all php files will need the .php to be executed.

Posted: Sun Feb 04, 2007 4:37 am
by volka
Might also be a ForceType directive.