Hi

On my site root in index.php I want to redirect to a subdomain with:

if ($COOKIE["region"]) {
// redirect to region
header ("location: http://www." . $
COOKIE["region"] . ".argyllnewmedia.co.uk");
exit;
}

I have subdomains set up in Cpanel which redirect for example:
www.london.argyllnewmedia.co.uk
to
www.argyllnewmedia.co.uk/london/

The problem is it is not loading the page. It works fine if I use:

header ("location: http://www.argyllnewmedia.co.uk/" . $_COOKIE["region"]);

..but I would rather the subdomain be visible in the URI.

    wouldnt the FQDN for the sub be:

    http://london.argyllnewmedia.co.uk

    otherwise your basically using www as a sub-domain of your sub-domain

    either way when i try these urls they both resolve to a page with "dgdfgdfg" on them

      Hi scrupul0us,

      I haven't changed anything in my code but within the last few minutes www.argyllnewmedia.co.uk correctly resolves to the page you mention.

      I did mail my host a support request so I'm not sure if they changed some apache configuration.

      However:

      header ("location: http://" . $_COOKIE["region"] . ".argyllnewmedia.co.uk");

      Does not display www.london.argyllnewmedia.co.uk in the URI.

      I've got a feeling this may be something I need to do in Apache. Can anyone help with that here or should I post in an apache forum?

        it wont display it... the header will redirect to that address... but the server then redirects to the home of the subdomain...

        I run a hosting farm with Helm and IIS and I can say that the way it handles subdomains is not with a redirect but rather with its own instance...

        for apache more than likely you'll need to create a virtual host that references the proper directory as its home and turn off the redirect

          I checked cpanel and there was a redirection on london. I've removed it and all is well now. 🙂

          I have no idea why the page wouldn't resolve last night and this morning though.

            Write a Reply...