1. Advertising
    y u no do it?

    Advertising (learn more)

    Advertise virtually anything here, with CPM banner ads, CPM email ads and CPC contextual links. You can target relevant areas of the site and show ads based on geographical location of the user if you wish.

    Starts at just $1 per CPM or $0.10 per CPC.

301 mod rewrite redirect

Discussion in 'Site & Server Administration' started by fadetoblack22, Apr 29, 2009.

  1. #1
    Can somone tell me what is the difference between these two statements:
    SEMrush
    RewriteCond %{THE_REQUEST} ^[A-Z]{3,9}\ /index\.html\ HTTP/
    RewriteRule ^index\.html$ http://www.example.com/ [R=301,L]

    RewriteCond %{THE_REQUEST} ^[A-Z]{3,9}\ /.*index\.html\ HTTP/
    RewriteRule ^(.*)index\.html$ http://www.example.com/$1 [R=301,L]

    I am trying to mod rewrite my index.html file to the root domain and have found these two examples, but they are different.

    thanks
     
    fadetoblack22, Apr 29, 2009 IP
    SEMrush
  2. Lpe04

    Lpe04 Peon

    Messages:
    579
    Likes Received:
    15
    Best Answers:
    0
    Trophy Points:
    0
    #2
    The first one will only redirect http://www.example.com/index.html

    The second will redirect anything that has index.html on the end of it to the folder it is in.

    They will both do the same thing, but the second goes a step further.
     
    Lpe04, Apr 29, 2009 IP
    fadetoblack22 likes this.
  3. fadetoblack22

    fadetoblack22 Well-Known Member

    Messages:
    2,332
    Likes Received:
    52
    Best Answers:
    0
    Trophy Points:
    160
    #3
    Thanks for the answer! Does it need to be in the .htaccess of every folder or just the root?
     
    fadetoblack22, Apr 29, 2009 IP
  4. Lpe04

    Lpe04 Peon

    Messages:
    579
    Likes Received:
    15
    Best Answers:
    0
    Trophy Points:
    0
    #4
    just the root, otherwise it will have no effect on

    http://www.example.com/
     
    Lpe04, Apr 29, 2009 IP
  5. fadetoblack22

    fadetoblack22 Well-Known Member

    Messages:
    2,332
    Likes Received:
    52
    Best Answers:
    0
    Trophy Points:
    160
    #5
    thanks for the help!
     
    fadetoblack22, Apr 30, 2009 IP