Forum Moderators: bakedjake

Message Too Old, No Replies

Need help configuring htaccess

using 301 redirects

         

Egbert Souse

3:20 am on Jun 18, 2005 (gmt 0)

10+ Year Member



I have a current .htaccess file that redirects htm and html files to their shtml counterparts on my site. I have just rewritten the site using php extensions (I know, welcome to the future)

I now need to modify my htaccess file to redirect htm, html, shtml files to their php counterparts.

So right now a page page1.shtml also exists as page1.php When someone enters page1.shtml I want to redirect them to page1.php and in the address bar it shows up as page1.php

My old htaccess file looks like this

ErrorDocument 404 /missing.shtml
<Files .htaccess>
order allow,deny
deny from all
</Files>
<Limit PUT DELETE>
order deny,allow
deny from all
</Limit>
RewriteEngine on
RewriteBase /
RewriteRule ^(.*)\.htm$ $1 [C,E=WasHTM:yes]
RewriteCond %{REQUEST_FILENAME}.shtml -f
RewriteRule ^(.*)$ $1.shtml [S=1]
RewriteCond %{ENV:WasHTM} ^yes$
RewriteRule ^(.*)$ $1.htm

I'm wondering if there is a real clean way to do this. The site was originally done in the 90's (97 I think). there are still some links to the old htm pages which is why I need them redirected. Same with the html pages.

Thanks for any help and input you can give.