.htaccess 301: www.domain.com/index.htm to www.domain.com

Discussion in 'Apache' started by northpointaiki, Jan 1, 2006.

  1. #1
    Hi all -

    I'm sure this is an easy one for one who knows (which doesn't include me):

    I want to redirect all index.htm to my root. I've tried this, but it doesn't work:

    RewriteRule ^index.htm$ ^ [R=301]

    Can someone help me out?

    Thanks.
     
    northpointaiki, Jan 1, 2006 IP
  2. MaxPowers

    MaxPowers Well-Known Member

    Messages:
    264
    Likes Received:
    5
    Best Answers:
    1
    Trophy Points:
    120
    #2
    RewriteEngine on
    RewriteRule ^(.*)index.html$ / [R=301]

    maybe.... untested, but it should work
     
    MaxPowers, Jan 7, 2006 IP
  3. error10

    error10 Peon

    Messages:
    73
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    0
    #3
    It needs a RewriteBase / or a / in the URL itself in the rule.

    e.g. RewriteRule ^/index.htm$ / [R=301,L]
     
    error10, Jan 7, 2006 IP