Quick simple question about rewrite

# Rewrite index.html to folder
RewriteRule ^(.*/)?index\\.html?$ /$1 [R=301,L]

# Rewrite non-www (non-canonical) to www
RewriteCond %{HTTP_HOST} !^www\\. [NC]
RewriteRule (.*) http://www.%{HTTP_HOST}/$1 [R=301,L]

In the above code the question mark after the html says it can read htm too correct? What about the dollar sign? And if I wanted to make it universal for php ext too how would it look? I could fudge it but I don’t know if the $ sign needs to stay for both and etc. Thanks!

So should it look exactly like this…



$ matches the end of the string, so that there can’t be any other characters in the string after index.html.

Yup! :slight_smile:

Thanks for the validation Jeff!