PHP Redirect problem with subdomain

Posted by gms8994 on Stack Overflow See other posts from Stack Overflow or by gms8994
Published on 2010-03-23T15:48:15Z Indexed on 2010/03/23 23:43 UTC
Read the original article Hit count: 373

Filed under:
|

I'm using PHP to redirect a page back to the previous page with the following:

header("Location: {$_SERVER['HTTP_REFERER']}");

This set of pages will only be used by internal users, so I'm not terribly concerned about the fact that the referer will not always be available.

The problem I'm running in to is that if the referer looks like http://subdomain.domain.com/test.php?id=13, the redirect ends up going to http://subdomain.domain.com/.domain.com/test.php?id=13. Notice the additional .domain.com/ in the url.

I've tested by hardcoding the value, and it causes the problem as well. phpMyAdmin seems to suffer the same issue, but only on this particular server.

If this is not an SO question, please move accordingly.

© Stack Overflow or respective owner

Related posts about php

Related posts about redirect