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

Need help installing PHP, configuring a script, or configuring a server? Then come on in and post your questions! We'll try to help the best we can!

Moderator: General Moderators

Post Reply
The Bat
Forum Newbie
Posts: 14
Joined: Thu Feb 01, 2007 3:57 pm

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

Post 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?
User avatar
Ollie Saunders
DevNet Master
Posts: 3179
Joined: Tue May 24, 2005 6:01 pm
Location: UK

Post by Ollie Saunders »

I think it could be a number of things - mod_rewrite is the most likely culprit.
Post your config.
User avatar
AKA Panama Jack
Forum Regular
Posts: 878
Joined: Mon Nov 14, 2005 4:21 pm

Post 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.
User avatar
volka
DevNet Evangelist
Posts: 8391
Joined: Tue May 07, 2002 9:48 am
Location: Berlin, ger

Post by volka »

Might also be a ForceType directive.
Post Reply