Grow your CSS skills. Land your dream job.

PHP redirect dependent on domain

  • # June 10, 2009 at 9:56 am

    I got a GoDaddy hosting account, the economy plan to save money. But you can only add domains to point to the root. How would I create a php script that would for example go:

    IF domain is "phpmyadmin.com" GOTO "../php"
    IF domain is "somatelse.com" GOTO "../som"

    Any ideas?

    # June 10, 2009 at 11:09 am

    I’ve had a go at this myself. This will work correctly, right?

    Code:
    < ?php
    if( $_SERVER['HTTP_HOST'] == 'www.new.co.uk') {
    header( 'Location: ../new' );
    } elseif( $_SERVER['HTTP_HOST'] == 'www.old.co.uk') {
    header( 'Location: ../old' );
    }
    ?>
Viewing 2 posts - 1 through 2 (of 2 total)

You must be logged in to reply to this topic.

*May or may not contain any actual "CSS" or "Tricks".