Need help with htaccess - site1.com to site2.com/cat and site1.com/p1 to site2.com/p1

Discussion in 'Apache' started by MixedBag, Nov 2, 2011.

  1. #1
    Ive tried several different combinations of htaccess code and none have worked and i'm very frustrated now :(.

    I want site1.com/post1 etc to redirect to site2.com/post1 which is simple enough (although none of the code ive tried tonight has made that work, I must be tired). I however also want site1.com to redirect to site2.com/category1

    At the moment, nothing is working but, I have in the past got one or the other to work but, not both. At the time it wasnt that important so I didnt pursue it but, this time around it is an important task to get this done, otherwise I can't move forward. I'd really appreciate it if anyone could help with this problem I'm having, its causing me headaches :confused:.

    Thanks
     
    MixedBag, Nov 2, 2011 IP
  2. pr0t0n

    pr0t0n Well-Known Member

    Messages:
    243
    Likes Received:
    10
    Best Answers:
    10
    Trophy Points:
    128
    #2
    I believe something like this should work in your .htaccess file on site1.com :
    
    RewriteEngine On
    RewriteBase /
    
    RewriteRule ^$ http://www.site2.com/category1 [L,R=301]
    RewriteRule ^post([^/]+)$ http://www.site2.com/post$1 [L,R=301]
    
    Code (markup):
     
    pr0t0n, Nov 2, 2011 IP