URL redirection help needed..please.

Discussion in 'Programming' started by maxsmuter, Nov 5, 2006.

  1. #1
    Hi,
    I have recently changed my domain name, and hence I am loosing ot on a lot of visitors on my old site. I need a url redirection script, but a different one.

    For eg. if some one visits : http://www.myolddomain.com/abc/ghi/
    then he should be redirected to http://www.newdomain.com/ggh/rrr/ghi/

    I just want the "ghi" to remain the same. Please help me..is this possible?
     
    maxsmuter, Nov 5, 2006 IP
  2. nico_swd

    nico_swd Prominent Member

    Messages:
    4,153
    Likes Received:
    344
    Best Answers:
    18
    Trophy Points:
    375
    #2
    Do you still own your old domain? Just put this in the abc folder

    <META HTTP-EQUIV="Refresh" CONTENT="0;URL=http://www.newdomain.com/ggh/rrr/ghi/">
    
    Code (markup):
     
    nico_swd, Nov 5, 2006 IP
  3. maxsmuter

    maxsmuter Peon

    Messages:
    138
    Likes Received:
    6
    Best Answers:
    0
    Trophy Points:
    0
    #3
    Yes, I do own the old domain.
    But what I want is the url should be taken from the user, for eg. if the user types www.abc.com/xyz/ ,it should go to www.ghi.com/xyz/

    xyz, can be anything according to the users wish.. I cannot fix it.

    any clues..?
     
    maxsmuter, Nov 5, 2006 IP
  4. nico_swd

    nico_swd Prominent Member

    Messages:
    4,153
    Likes Received:
    344
    Best Answers:
    18
    Trophy Points:
    375
    #4
    Try .htaccess
    
    RedirectMatch ^([a-zA-Z0-9\/]*)$ http://www.ghi.com/$1
    
    Code (markup):
    (Untested)
     
    nico_swd, Nov 5, 2006 IP
  5. maxsmuter

    maxsmuter Peon

    Messages:
    138
    Likes Received:
    6
    Best Answers:
    0
    Trophy Points:
    0
    #5
    can you please explain , what to do in the above case, I am not a programmer..:(
     
    maxsmuter, Nov 5, 2006 IP
  6. nico_swd

    nico_swd Prominent Member

    Messages:
    4,153
    Likes Received:
    344
    Best Answers:
    18
    Trophy Points:
    375
    #6
    Save this as ".htaccess" in the root dir on the server where you want to redirect.
     
    nico_swd, Nov 5, 2006 IP
  7. Richie_Ni

    Richie_Ni Illustrious Member

    Messages:
    10,721
    Likes Received:
    1,175
    Best Answers:
    0
    Trophy Points:
    410
    #7
    Redirect /xyz/ http://www.ghi.com/xyz/
    Code (markup):
    Copy and paste it into your notepad and save it as ".htaccess" file.Then upload it to the xyz folder of the abc.com directory.
     
    Richie_Ni, Nov 5, 2006 IP
  8. nico_swd

    nico_swd Prominent Member

    Messages:
    4,153
    Likes Received:
    344
    Best Answers:
    18
    Trophy Points:
    375
    #8
    The thing is that xyz can be anything. So the RedirectMatch would be more useful.
     
    nico_swd, Nov 5, 2006 IP
  9. maxsmuter

    maxsmuter Peon

    Messages:
    138
    Likes Received:
    6
    Best Answers:
    0
    Trophy Points:
    0
    #9
    ok, thanks a lot..job done. Great!:)
     
    maxsmuter, Nov 5, 2006 IP