Forum Moderators: phranque

Message Too Old, No Replies

Files with No Extensions -> file.htm -> file.php -> file.html

How to run files with no extensions and rotate from: htm to php to html

         

jpmadmin

11:47 am on Jul 9, 2011 (gmt 0)

10+ Year Member



I just setup a new Web dedicated CentOS server.

I have files with No Extensions ( ex. www.abc.com/file ) and need them to work as follows:

1) www.abc.com/file.htm

2) www.abc.com/file.php

3) www.abc.com/file.html


What should I put into:

A) httpd.conf

B) .htaccess (if needed)

C) ?

Thanks, in advance, for your help !

lucy24

4:36 pm on Jul 9, 2011 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



htm : html is trivial. You just rewrite the incorrect form to the correct one. But having files in the same directory that differ only in their extensions strikes me as, er, a bit suicidal.

The function of htaccess is, loosely, to convert what your user typed (or what their link said) into the actual name of your real file. But with rare exceptions it can only do what you explicitly tell it to do. Don't expect htaccess to paw through your files and figure out which is the "real" php. It isn't paid to think.

There is a good deal of overlap between what can go in a configuration file and what can go in an htaccess file. In general, put things in the highest level you have access to, unless you have a set of behaviors that need to be specific to one directory.