.htaccess help

Discussion in 'Site & Server Administration' started by calum, Nov 27, 2007.

  1. #1
    Hello.

    I need some help with .htaccess files thanks.

    I have my personal website at www.calumneilson.com, it also has lots of sub-pages where most of the visits come from.

    I now want to direct ALL traffic from www.calumneilson.com to www.calumneilson.com/blog

    So if someone went to www.calumneilson.com/page1.php it would redirect to www.calumneilson.com/blog

    But I want it so that links in the blog still work, so things like www.calumneilson.com/blog/post1 WONT redirect to www.calumneilson.com/blog

    I also want them to be 301 redirects.

    Thanks
    Calum
     
    calum, Nov 27, 2007 IP
  2. st1905

    st1905 Well-Known Member

    Messages:
    573
    Likes Received:
    23
    Best Answers:
    0
    Trophy Points:
    135
    #2
    RewriteEngine On
    
    RewriteCond %{HTTP_REFERER} !^www.calumneilson.com [NC]
    RewriteRule /* www.calumneilson.com/blog [R,L]
    Code (markup):
    Try this and let me know if it works.
     
    st1905, Nov 27, 2007 IP
    calum likes this.
  3. calum

    calum Peon

    Messages:
    2,821
    Likes Received:
    141
    Best Answers:
    0
    Trophy Points:
    0
    #3
    Hey, I think I remember you from somewhere, nevermind :)

    Thanks for helping, I tried this but now it goes to:

    http://www.calumneilson.com/home/calum/public_html/www.calumneilson.com/blog

    and then Firefox says:

    Thanks
    Calum
     
    calum, Nov 27, 2007 IP
  4. calum

    calum Peon

    Messages:
    2,821
    Likes Received:
    141
    Best Answers:
    0
    Trophy Points:
    0
    #4
    Everything is working now, thanks st1905 :D
     
    calum, Nov 27, 2007 IP
  5. st1905

    st1905 Well-Known Member

    Messages:
    573
    Likes Received:
    23
    Best Answers:
    0
    Trophy Points:
    135
    #5
    You`re welcome as always calum.
     
    st1905, Nov 27, 2007 IP