How to enable 'magic' file extensions?

nemonoman

Verified User
Joined
Apr 7, 2007
Messages
26
Hi:
On my redhat and fedora4 boxes, apache does some magic with file extensions.

For example if I browse "mydomain.com/somefile" Apache loads

mydomain.com/somefile.php if that exists

mydomain.com/somefile.html if no .php file, and somefile.html exists.

My new CentOS4 server doesn't do this. Full file name plus extension needed. Don't know what to call the function to look it up on Google.

Thanks.

Nemo
 
Why don't you give us a real world example. What is your domain? What file can be loaded without an extension?
 
Sounds like a mod_rewrite thing to me. I don't think apache has a configuration that can do it. You can always compare the two httpd.conf files for differences.
 
Thanks. Have. If its in httpd.conf, I don't see it.

If it's in mod_rewrite, I can't figure out the regex.
 
Here's the answer -- MultiView Option

Found the answer, finally:

modify httpd.conf (/etc/httpd/conf/httpd.conf)

You want to add the MultiViews Option to the /home/* Directory

<Directory /home/*>
AllowOverride All
Options MultiViews -Indexes FollowSymlinks IncludesNoExec +Includes
<Limit GET POST OPTIONS PROPFIND>
Order allow,deny
Allow from all
</Limit>
<LimitExcept GET POST OPTIONS PROPFIND>
Order deny,allow
Deny from all
</LimitExcept>
</Directory>

Save changes and restart apache

service httpd restart

In my httpd.conf, the text said

Options -MultiViews

I simply removed the " - "

If you don't see the word MultiViews in your options, add it. "Options All" will not work, according the docs. (Note InTerCaps in MultiView).

Here's the apache documentation

http://httpd.apache.org/docs/2.0/content-negotiation.html
 
Back
Top