This is a discussion on forward http:// to http://www every time? within the PHP General forums, part of the PHP Programming Forums category; Is there a way to forward any browser query of http://mysite.com/anything/anything to http://www.mysite.com/...
|
|||||||
| FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
|
|||
|
Is there a way to forward any browser query of
http://mysite.com/anything/anything to http://www.mysite.com/anything/anything? Anyone know? |
|
|||
|
Alex wrote: > Is there a way to forward any browser query of > http://mysite.com/anything/anything to > http://www.mysite.com/anything/anything? > > Anyone know? if(strpos($_SERVER['HTTP_HOST'], 'www') !== 0) { $newURL = 'http://www.' . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI']; header("Location: $newURL"); } |