Run php files without .php extension -- WHAT'S THE TRICK I USED??

nemonoman

Verified User
Joined
Apr 7, 2007
Messages
26
You know what I mean -- http://mydomain/myfile loads and runs myfile.php, without requiring or showing the .php extension.

I did some trick, years ago, and I can't remember what it was. Added a line to some directadmin apache file, I think.

Just did this ONE TIME, ONE PLACE, and every website did the trick.

I have create cloned servers based on my original DA setup, and this trick works on all sites on all cloned servers.

I have just set up a directadmin server from scratch however, and I CANNOT FIND THE TRICK that I used in my cloned servers.

I have validated that the following files are identical on both servers
Code:
/etc/httpd/conf/httpd.conf
/usr/local/lib/php.ini
on a per site level I have validated that the site's .htaccess files are identical.

I have validated that the da created httpd.conf files found in
Code:
/usr/local/directadmin/data/users/USERNAME
are identical except for IP addreses, paths, etc.

I cannot remember the trick I did? Can anyone help?

Nemo
 

wattie

Verified User
Joined
May 31, 2008
Messages
1,054
Location
Bulgaria
Mod_rewrite is the correct solution for your case. You can add this in .htaccess file:

RewriteEngine On
RewriteRule something something.php [L]
When you visit yourdomain.dom/something it will load yourdomain.dom/something.php

Add more lines for more files.
 

ditto

Verified User
Joined
Apr 27, 2009
Messages
2,536
@zEitEr, On a default DirectAdmin Apache 2.4.38 install it works just fine using MultiViews in .htaccess. I have tested by adding this to .htaccess

Code:
Options +MultiViews
And it works correct. You can then browse to www.yourdomain.tld/filename without any extension at the end.
 

nemonoman

Verified User
Joined
Apr 7, 2007
Messages
26
Final Answer

Thanks to Alex and Ditto for your help.

I wanted this option to work on all sites on my server, without having to go through adding to dozens of .htaccess files.

The global solution was to modify

/etc/httpd/conf/extra/httpd-directories.conf
and to change the line
Options -MultiViews
to
Options +MultiViews

Works like a champ! Thanks guys.
Nemo
 
Top