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

How do I do this.

Discussion in 'Black Hat SEO' started by Ayomav, Mar 6, 2012.

  1. Ayomav

    Ayomav Regular Member

    Joined:
    Nov 23, 2011
    Messages:
    250
    Likes Received:
    19
    Hey guys,

    How do I redirect all urls to my homepage.

    Eg: domain.com/somepage.html or domain.com/somepage

    to redirect to

    domain.com

    And then,

    How do I redirect the domain.com to other domain, eg: domain1.com

    I tried htaccess method but doesn't work, I also then tried using 2 wordpress plugins to redirect all 404 page to homepage, then from homepage to other domain but it's not working out.

    Can anyone please solve this problem.

    Thanks
     
  2. amrak

    amrak Registered Member

    Joined:
    Jun 29, 2010
    Messages:
    74
    Likes Received:
    21
    Put this php code at the top of the site you want to redirect FROM. Change the site in the code to the page you want to redirect TO.

    PHP:
    header('Location: http://destination-site.com');
    die;
     
  3. Ayomav

    Ayomav Regular Member

    Joined:
    Nov 23, 2011
    Messages:
    250
    Likes Received:
    19
    This will only redirect a page or homepage right.

    If I want to redirect every page on the site, how do I do it.

    Thanks
     
  4. Amsterdammer

    Amsterdammer Power Member

    Joined:
    Aug 9, 2011
    Messages:
    515
    Likes Received:
    563
    If you put that code on your homepage in script tags...
    If you create a .php page and let any link, advertisement, button and such lead to that page when they click...
    If you create a timer event to execute this command...
    If you put that code on any html page in the body with script tags...

    You are redirected. ;)
    You can even make an eternal loop between all your domains this way. Wherever I said page you can replace by domain as you please.

    If you feel there are too many pages, why not make a template so you only have to change the name?
    Or write a script to edit the pages.

    I don't think there is any way around including this on either all your pages you want to redirect from or put it in a function. But even then you would still need to call to that function from the page you want to redirect from.

    Personally, I wondered why he added the "die" part as it works just fine without it too and I only know this part from SQL.
    Then again, I still have a lot to learn, he probably does not. :p

    Time for me to visit w3schools again lol
     
  5. amrak

    amrak Registered Member

    Joined:
    Jun 29, 2010
    Messages:
    74
    Likes Received:
    21
    Because if php continues, other headers and output may affect the header statement we actually care about ;)

    But you're not wrong, It still might work without the "die;" part about 99% of the time.
     
    • Thanks Thanks x 1
  6. Amsterdammer

    Amsterdammer Power Member

    Joined:
    Aug 9, 2011
    Messages:
    515
    Likes Received:
    563
    Thank you Amrak. :)

    Short and simple, very clear. :)