www.domain.com/forum/ redirected to www.domain.org/forum/

Discussion in 'HTML & Website Design' started by Crux, Apr 12, 2007.

  1. #1
    how can this be done?

    i have this core:

    <?
    //get the page searched for.
    $root=$_SERVER[”DOCUMENT_ROOT”];
    $page = parse_url($_SERVER[”REQUEST_URI”]);
    $page=$page[path];
    
    //find the extension of current page
    $ext_array =explode(”.”,$page);
    $last = count($ext_array) - 1;
    $ext = $ext_array[$last];
    
    $real404 = 1;
    
    if ($ext==”html”) {
    $ext = “.$ext”;
    $page=str_replace($ext,”,$page);
    $extpage=$page.”.php”;
    if (file_exists($root.$extpage)) {
    $real404 = 0;
    include “$extpage”;
    }
    }
    if($real404) {
    ?>
    
    <html>
    <head>
    <title>Page Not Found</title>
    </head>
    <body>
    <h1>Page Not Found</h1>
    If possible, the browser will try redirecting you to the appropriate place. Otherwise, the file you clicked isn't found!
    Try going to the index page
    </body>
    </html>
    <?
    }
    ?>
    
    
    
    
    
    
    
    
    
    <html>
    <html>
    <head>
    <title>GsmIn.com</title>
    
    <?php
    $url = parse_url($HTTP_REFERER);
    $check=strtolower($url["host"]);
    if ($check!='tuga-gsm.com')
    {
    $root=$_SERVER["DOCUMENT_ROOT"];
    $page = parse_url($_SERVER["REQUEST_URI"]);
    $page=$page[path];
    echo "<meta http-equiv="Refresh" content="1; url=http://www.gsmin.com$page\">";
    echo ‘<meta name=”robots” content=”noindex,follow” /> ‘;
    }
    ?>
    
    </head>
    </html>
    
    
    HTML:
    where is the problem?

    in this case, i want to redirect all incomming clicks to tuga-gsm.com to gsmin.com

    i could just add a parked domain in cpanel, but in fact there is a cookies problem and forum must always be run from gsmin.com


    btw. as you can see, there are 2 samples in previous code. none worked :(
     
    Crux, Apr 12, 2007 IP
  2. DPNoob

    DPNoob Peon

    Messages:
    6
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #2
    Make an HTML page on the domain.com/forum/ and label it index.html, and then get a redirection html code from google and it will work fine... Or look at the one i have right here for you.

    Place the following HTML redirect code between the <HEAD> and </HEAD> tags of your HTML code.
    
    <meta HTTP-EQUIV="REFRESH" content="0; url=http://www.domain.org/forum">
    
    HTML:
    Good Luck,

    -Justin

    P.S. If you can't figure it out from what I gave you, PM me and I will help you.
     
    DPNoob, Apr 12, 2007 IP
  3. QiSoftware

    QiSoftware Well-Known Member

    Messages:
    805
    Likes Received:
    10
    Best Answers:
    0
    Trophy Points:
    158
    #3
    To redirect in PHP you need something like the following:
    <?php 
    header("Location: ./");
    ?>
    Code (markup):
    Q...
     
    QiSoftware, Apr 12, 2007 IP
  4. Crux

    Crux Well-Known Member

    Messages:
    704
    Likes Received:
    14
    Best Answers:
    0
    Trophy Points:
    130
    #4
    thanks for the reply

    the /forum was an example

    i want to redirect anything

    www.tuga-gsm.com/* gors to www.gsmin.com/*
     
    Crux, Apr 12, 2007 IP
  5. DPNoob

    DPNoob Peon

    Messages:
    6
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #5
    Oh, like a WildCard type thing, my code won't help then.
     
    DPNoob, Apr 12, 2007 IP
  6. Crux

    Crux Well-Known Member

    Messages:
    704
    Likes Received:
    14
    Best Answers:
    0
    Trophy Points:
    130
    #6
    is there any php sintax error in this script?

    <?php
    $root=$_SERVER["DOCUMENT_ROOT"];
    $page = parse_url($_SERVER["REQUEST_URI"]);
    $page=$page[path];
    echo "<meta http-equiv="Refresh" content="1; url=http://www.gsmin.com$page\">";
    echo ‘<meta name=”robots” content=”noindex,follow” /> ‘;
    ?>

    </head>
    </html>

    according to some info found in google, this would work :-s
     
    Crux, Apr 12, 2007 IP