Simple .htaccess question

Discussion in 'Apache' started by DrewAMP, Sep 30, 2009.

  1. #1
    Hey guys,

    Not too good with the .htaccess code, so hopefully one of you may know the answer to this question. What I want to do is pretty simple.

    All I want to do is redirect any folder to my index.html file.

    I actually had a Wordpress blog before I turned my site into a static HTML page. So I have a bunch of URLs like:

    www.domain.com/just-an-example/
    www.domain.com/post-title-here/
    www.domain.com/blah-blah-blah/

    I want to get those all to redirect to www.domain.com/index.html

    Anyone know how to do this?
     
    DrewAMP, Sep 30, 2009 IP
  2. Azkaban

    Azkaban Peon

    Messages:
    537
    Likes Received:
    11
    Best Answers:
    0
    Trophy Points:
    0
    #2
    Use this:

    RewriteRule (.*) index.html [R=301,L]
    Code (markup):
     
    Azkaban, Sep 30, 2009 IP
  3. Azkaban

    Azkaban Peon

    Messages:
    537
    Likes Received:
    11
    Best Answers:
    0
    Trophy Points:
    0
    #3
    Use this:

    RewriteRule (.*) index.html [R=301,L]
    Code (markup):
     
    Azkaban, Sep 30, 2009 IP
  4. dren

    dren Active Member

    Messages:
    86
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    51
    #4
    Remember to use the

    RewriteEngine On

    line first ;)
     
    dren, Sep 30, 2009 IP
  5. Azkaban

    Azkaban Peon

    Messages:
    537
    Likes Received:
    11
    Best Answers:
    0
    Trophy Points:
    0
    #5
    Point noted. Will add that too in future.

    Actually, I thought that lines about "RewriteBase" and "RewriteEngine On" are pretty obvious.
     
    Azkaban, Oct 1, 2009 IP