Helpful Information
 
 
Category: Server side development
.htaccess rewrite *.shtml to *.html

As titled really, I'm thinking I might change out my SSI for php includes, inorder to keep links operational until they're changed or filter out I'd like to change requested .shtml files to .html, how?

thanks :eek:

Hmm, I think this exact question came up a while ago...



<Directory "httpd local directory path">
RewriteEngine on
RewriteBase /
RewriteRule ^(.*)\.shtml$ $1.html [R=permanent]
</Directory>


--or--



RewriteEngine on
RewriteBase /
RewriteRule ^(.*)\.shtml$ $1.html [R=permanent]


or this would check to see if the html version of the requestes shtml page exists before redirecting


RewriteEngine on
RewriteBase /
RewriteRule ^(.*)\.shtml$ $1 [C,E=WasSHTML:yes]
RewriteCond %{REQUEST_FILENAME}.html -f
RewriteRule ^(.*)$ $1.html [S=1,R]
RewriteCond %{ENV:WasSHTML} ^yes$
RewriteRule ^(.*)$ $1.html


Here's the original thread if you need it : http://freewarejava.com/ubb/Forum5/HTML/004908.html










privacy (GDPR)