SitePoint Sponsor

User Tag List

Results 1 to 6 of 6
  1. #1
    SitePoint Member
    Join Date
    Apr 2006
    Posts
    4
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Redirect help please

    I am moving my site from ASP to PHP soon and would like help please on the following index.asp page redirect code which I use to keep the URL in the browser...plus its better than 'forwarding' at the domain register.

    Is there an equivalent in PHP which will do the same thing??

    Here's the code:

    <%
    Dim sServer
    sServer = UCase(Request.ServerVariables("SERVER_NAME"))
    If Instr(sServer,"SITEONE.COM.AU") > 0 Then
    Response.Redirect "/home.asp"
    ElseIf Instr(sServer,"SITETWO.NET.AU") > 0 Then
    Response.Redirect "/home.asp"
    End IF
    %>

    thanks for any assistance.

  2. #2
    SitePoint Wizard silver trophy
    Join Date
    Mar 2006
    Posts
    6,132
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    i dont know asp, but ill take a guess at it


    PHP Code:
    $sn strtoupper($_SERVER['SERVER_NAME']);

    if (
    false !== strpos($sn'SITEONE.COM.AU')) {
        
    header('Location: home.php');
    } elseif (
    false !== strpos($sn'SITETWO.NET.AU')) {
        
    header('Location: home.php');


  3. #3
    SitePoint Member
    Join Date
    Apr 2006
    Posts
    4
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    thanks clamcrusher....won't know if it works until my DNS switch happens next week. appreciate you having a go though :-))

  4. #4
    SitePoint Member
    Join Date
    Apr 2006
    Posts
    4
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    $sn = strtoupper($_SERVER['SERVER_NAME']);

    if (false !== strpos($sn, 'SITE1.COM.AU')) {
    header('Location: main1.php');
    } elseif (false !== strpos($sn, 'SITE2.COM.AU')) {
    header('Location: main2.php');
    }
    endif;

    Ok - I tested as above and got the error below......

    Parse error: parse error, unexpected T_ENDIF

  5. #5
    SitePoint Wizard silver trophy
    Join Date
    Mar 2006
    Posts
    6,132
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    i never put an endif; in my post. you must have added that.

  6. #6
    SitePoint Member
    Join Date
    Apr 2006
    Posts
    4
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    oh.ok.. sorry there I am thinking .asp


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •