Forum Moderators: phranque
.* at the beginning or in the middle of a RegEx pattern. RewriteCond in the index redirect you will get an infinite loop. RewriteCond %{THE_REQUEST} ^[A-Z]{3,9}\ /([^/]+/)*index\.html\ HTTP/
RewriteRule ^(([^/]+/)*)index\.html http://www.example.com/$1 [R=301,L]
RewriteCond %{HTTP_HOST} !^(www\.example\.com)?$
RewriteRule (.*) http://www.example.com/$1 [R=301,L] RewriteCond %{THE_REQUEST} ^[A-Z]{3,9}\ /([^/]+/)*index\.html\ HTTP/
RewriteRule ^(([^/]+/)*)index\.html http://www.example.com/$1 [R=301,L]
Not sure I have any infinite loops since I don't know what to look for. Would I get a message "infinite loop"?
RewriteRule ^oldfile$ "http\:\/\/www\.example\.com\/newfile\.html"
# html file to php because I gave an old file wrong ext
RewriteCond %{HTTP_HOST} ^www\.example\.com$
RewriteRule ^file\.html$ "http\:\/\/www\.example\.com\/file\.php" [R=301,L]
# keep last
ErrorDocument 404 /notfound.html
# html file to php because I gave an old file wrong ext
RewriteCond %{HTTP_HOST} ^www\.example\.com$
RewriteRule ^file\.html$ "http\:\/\/www\.example\.com\/file\.php" [R=301,L] List of urls readily available from my website sitemap so can copy that real quick.
Rules 5 through 8 could be collapsed into a single rule, as noted about halfway up this thread. But if only four pages are involved, it probably does run faster if you list them by name. That way the server doesn't have to stop and check every single request.