Page is a not externally linkable
- Code, Content, and Presentation
-- Apache Web Server
---- Canonical Issue


milosevic - 11:40 am on Nov 23, 2010 (gmt 0)


Something like

RewriteRule ^(.*)/index(\.html|/)?$ http://www.example.com/$1 [R=301,L]

Note I didn't test this and wrote it off the top of my head, may need some tweaking and you may need a rewritecondition.

Two points:

Use example.com - your links won't get turned into URLs on here and it's easier to work with.

Follow coding standards - "rewritecond" is wrong - it's "RewriteCond" - as is r=301 - should be R=301. It may seem pedantic but it matters much more with Apache directives and mod_rewrite than other types of code. Yeah, the code still works on your server with the wrong case, but if you ever move servers you could find all this code suddenly stops working.


Thread source:: http://www.webmasterworld.com/apache/4232451.htm
Brought to you by WebmasterWorld: http://www.webmasterworld.com