Forum Moderators: phranque
Nr1: RewriteRule ^(.+)\.html$ $1 [R=301,L]
Nr2: RewriteRule ^([\w-]+)\html$ $1 [R=301,L]
Nr3: RewriteRule ^([\w-]+)\.html$ /index.php?$1 [R=301,L]
Nr4: RewriteRule ^([\w-]+)\.html$ http://www.example.comm/$1 [R=301,L]
([\w-]+)\html
www.example.comm
Typos?Rules #1-#3 are missing the protocol-plus-domain, which should be a part of every external redirect. Otherwise people who asked for the wrong form of the hostname will get redirected twice.
Yes, "after-midnight-typos"
([\w-]+)\.html
www.example.com
are correct.
If your existing URLs might include directory slashes, make sure the pattern allows them. Patterns with non-final .+ or .* are generally the last resort.
Site 2 has one directory and therefore about 20 URLs like www.example.com/dir/old-page-1.html and additionally about 40 like www.example.com/old-page-1.html
Nr4 does not cover this for both sites properly? What code would you choose for site 1 and site 2 then?