Web Analytics Made Easy -
StatCounter .htaccess rewrite *.shtml to *.html - CodingForum

Announcement

Collapse
No announcement yet.

.htaccess rewrite *.shtml to *.html

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • .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
    [+] Computer/PC issues [+] Silverpaw3D
    ------------------------------------------------
    Never buy a dwarf with learning disabilities...

    ...it's not big, and it's not clever.

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

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

    Code:
    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
    Code:
    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
    Moderator, Perl/CGI Forum
    shadowstorm.net - subvert society

    Comment

    Working...
    X