.htaccess - Rewriterule - How to add .html in .htacess -


how create rewriterule 301 redirect urls this:

http://www.domain.dk/bornetoj/body/

to:

http://www.domain.dk/bornetoj/body.html

best regards, jesper

  1. change of links in content this: http://www.domain.dk/bornetoj/body/

  2. the htaccess in document root, add these rules convert links without .html add resources can resolved, preferably above rules may have:

    rewriteengine on rewritecond %{request_uri} ^/(.*?)/?$ rewritecond %{document_root}/%1.html -f rewriterule ^(.*?)/?$ /$1.html [l] 
  3. in case still have links outside of control, can add these rules make sure html extension gets removed redirecting browsers 1 without extenion:

    rewritecond %{the_request} ^(get|head)\ /(^[\ \?]+)\.html rewriterule ^(.*)\.html$ /$1/ [l,r=301] 

Comments