1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

automatically rewrite url

Discussion in 'General Programming Chat' started by MastermindNL, May 13, 2010.

  1. MastermindNL

    MastermindNL Newbie

    Joined:
    May 22, 2009
    Messages:
    15
    Likes Received:
    4
    Occupation:
    Student/Entrepreneur
    Location:
    Europe
    Hello guys,

    I have searched for this and couldn't find anything on blackhatworld/google.

    I want to automatically change the url.

    When you enter:
    http://www.mydomain.com/page1/variable

    you need to go to:
    http://www.second-domain.com/page1/variable

    I know i can hard code it at the first location. But I would like to know if I can make a function for it or if it's possible to do with htaccess. I don't feel like hardcoding hundreds of pages. Maybe something like of "www.mydomain.com/page1" os in the url change it to "www.second-domain.com/page1/"

    A link to a tutorial or website that explains it will be enough :)
     
  2. Whisker

    Whisker Moderator Staff Member Moderator Premium Member

    Joined:
    Dec 26, 2007
    Messages:
    994
    Likes Received:
    1,322