lucy24 - 2:48 am on Feb 24, 2013 (gmt 0)
Unless you have extensionless "index" pages-- which would be pretty senseless ;)--the pattern can be simplified to
And you only need the question mark in html? if your site uses both forms. Remember that you only need to redirect index pages that actually exist; the others can take their 404 and lump it.
If you leave off the closing $ anchor you will concurrently get rid of visitors who are attempting some type of path-injection. This may or may not be desirable, depending on your real-life naming formats.
But the most important thing is to put the index redirect before the domain-name redirect. I mentioned in another thread that I recently discovered that requesting
on one of my sites led to THREE consecutive redirects. (One of the extras was laziness on my part; the other was a typo. Ugh. All fixed now.)