Results 1 to 6 of 6
Hybrid View
-
04-20-2005, 07:52 PM #1Junior Guru
- Join Date
- Oct 2003
- Posts
- 177
File type redirects with htaccess?
I've got a good-sized site with around 300 HTML pages. I'm doing some restructuring and changing all the HTML files to SHTML to take advantage of SSI. I plan on keeping filenames the exact same, just changing the extension - i.e. www.site.com/file.html to www.site.com/file.shtml
I'd like to use .htaccess to tell visitors looking for the HTML files to automatically go to the SHTML files. I don't really want to put 300+ lines of redirects in .htaccess, so I was wondering how I could make it so that [filename].html gets redirected to [filename].shtml automatically.
I do not plan on having any HTML files on the site any longer. So ANY request for an HTML should be forwarded to the SHTML version.
Does this make sense? Could anyone clue me in on how the language in htaccess should look? I appreciate any help.
-
04-20-2005, 08:48 PM #2rogue element
- Join Date
- Jun 2004
- Location
- Northwest Colorado
- Posts
- 4,636
You're into mod_rewrite territory there, which can be implemented in an .htaccess file. Sorry, I'm not any good with mod_rewrite, but I do know it's what you're after.
http://httpd.apache.org/docs/mod/mod_rewrite.htmlEric J. Bowman, principal
Bison Systems Corporation coming soon: a new sig!
I'm just a poor, unfrozen caveman Webmaster. Your new 'standards' frighten, and confuse me...
-
04-20-2005, 10:24 PM #3Junior Guru
- Join Date
- Oct 2003
- Posts
- 177
I think I might have it.
I've got cPanelX, and under "Apache handlers" I've got:
.cgi .pl cgi-script
.shtm server-parsed
.shtml server-parsed
Shouldn't I just be able to add:
.html server-parsed
And not even have to bother renaming all of my HTML files to shtml??
-
04-20-2005, 10:29 PM #4rogue element
- Join Date
- Jun 2004
- Location
- Northwest Colorado
- Posts
- 4,636
Heheh... Yeah, I shoulda thought of that...
-
04-20-2005, 10:33 PM #5Junior Guru
- Join Date
- Oct 2003
- Posts
- 177
So that should work? I'm a little leery of just jumping in and doing it on a live site without a second opinion. ;-)
-
04-20-2005, 11:34 PM #6Junior Guru Wannabe
- Join Date
- Sep 2003
- Location
- USA
- Posts
- 64
You mean something like:
http://www.gopherdesign.com/webdesign/directory
directory is not a folder. it is actually a php file.
I made a .htaccess file and made it look like:
<files directory>
SetHandler application/x-httpd-php
</files>AIM: GopherDesign
ICQ: 39 401 865
WWW: http://www.gopherdesign.com
WWW: http://www.gopherwebhosting.com