.htaccess to turn xxx.com to yyy.xxx.com therefore making yyy.xxx.com the default.

Discussion in 'Apache' started by slickk, Mar 28, 2007.

  1. #1
    Hello.

    I have the following domain: inichat.com

    I would like all requests to www.inichat.com or inichat.com to be redirected to tr.inichat.com

    If possible I would also like the search engines to "pick up" the site with that address "tr.inichat.com" kind of like del.icio.us

    How can I do this?

    Thanks.
     
    slickk, Mar 28, 2007 IP
  2. DaiTengu

    DaiTengu Active Member

    Messages:
    49
    Likes Received:
    4
    Best Answers:
    1
    Trophy Points:
    75
    #2
    Add the following to your .htaccess file in the root directory of your website:

    Options +FollowSymlinks
    RewriteEngine on
    RewriteCond %{HTTP_HOST} ^inichat\.com
    RewriteRule ^(.*)$ http://tr.inichat.com/$1 [R=permanent,L]
    RewriteCond %{HTTP_HOST} ^www.inichat\.com
    RewriteRule ^(.*)$ http://tr.inichat.com/$1 [R=permanent,L]
    Code (markup):
    This is a 301 redirect, so the search engines will pick up on the fact that this is the new domain, and the old one shouldn't be used any longer.
     
    DaiTengu, Mar 30, 2007 IP
  3. slickk

    slickk Peon

    Messages:
    11
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #3
    Thanks for your response.
    Unfortunately I can't get it work as I wanted it to.

    Here's the thing. I'm hosting on Godaddy and I have the option to have more than one domain on the same account.

    inichat.com is actually in a folder(chat) on triniwiki.com
    tr.inichat.com is another folder(trinichat) on triniwiki.com

    When I tried the .htaccess on the folder containing inichat.com it didn't redirect.

    When I tried it in the .htaccess in the root of triniwiki.com it didn't redirect to tr.inichat.com but it redirected to tr.inichat.com/chat (triniwiki.com/trinichat/chat) which is an existing folder.

    I hope this isn't confusing.

    Can you tell me what I need to do for it to work in this situation?

    Thanks.
     
    slickk, Apr 1, 2007 IP
  4. abdussamad

    abdussamad Active Member

    Messages:
    543
    Likes Received:
    17
    Best Answers:
    0
    Trophy Points:
    60
    #4
    in public_html/.htaccess of inchat:

    
    redirect 301 / http://tr.inchat.com
    
    
    Code (markup):
     
    abdussamad, Apr 5, 2007 IP
  5. slickk

    slickk Peon

    Messages:
    11
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #5
    Well I just wanted to say that this worked.
    Apparently I just had to wait for it to kick in on Godaddy.
     
    slickk, Apr 6, 2007 IP