.htaccess redirect help

Discussion in 'Apache' started by jaaahn, Sep 7, 2007.

  1. #1
    Hi all,

    looking for some friendly soul to help me with my .htaccess because I can't figure it out!

    I have one domain pointing at another domain, this is working.
    However, I have some articles from the old domain that I want to point at the place the articles are now at on the new domain.

    Both sites are addon/subdomains of another domain on hostgator so I guess it makes it a bit more tricky...
    I had a look at the redirects in CPanel, and it seems to only allow redirects from the main domain.

    Here's what I currently have in the .htaccess file on the old domain :

    Redirect permanent /?p=9 http://www.thenewdomain.com/index.php?option=com_content&task=view&id=19&Itemid=1
    
    Options +FollowSymLinks
    RewriteEngine on
    RewriteRule (.*) http://www.newdomain.com/$1 [R=301,L]
    
    Code (markup):
    So the first bit is supposed to forward oldomain.com/?p=9 to the new domain item, but only forwards to newdomain.com.?p=9 right now.

    Anybody able to help?

    Thanks
     
    jaaahn, Sep 7, 2007 IP
  2. evera

    evera Peon

    Messages:
    283
    Likes Received:
    8
    Best Answers:
    0
    Trophy Points:
    0
    #2
    I think the first redirect permanent conflicts with the 2nd redirect rule. Actually i don't see why you need the first bit, the second rule covers the first anyways...

    And shouldn't it be like this?
    
    Options +FollowSymLinks
    RewriteEngine on
    RewriteRule   ^/(.+)  http://www.newdomain.com$1  [R,L]
    Code (markup):
     
    evera, Sep 10, 2007 IP
  3. Nintendo

    Nintendo ♬ King of da Wackos ♬

    Messages:
    12,890
    Likes Received:
    1,064
    Best Answers:
    0
    Trophy Points:
    430
    #3
    Options +FollowSymLinks +Indexes
    RewriteEngine on
    RewriteBase /
    RewriteRule ^(.*)$ http://www.domain.com/$1 [R=301,L]
     
    Nintendo, Sep 10, 2007 IP
  4. jaaahn

    jaaahn Peon

    Messages:
    188
    Likes Received:
    3
    Best Answers:
    0
    Trophy Points:
    0
    #4
    Thanks for both the replies..
    however, I have several different pages that I want to forward to several other pages, with different ID/file scheme...
    in short, i need to forward them to distinct and different pages...

    both these pieces of code don't seem to address that, or a I missing something?
     
    jaaahn, Sep 10, 2007 IP