PHP Header Redirect
I'm trying to set up a header redirect to a mobile version of a site using the Mobile_Detect.php class.
I've got it working fine as a standard redirect to the main page, but I'd like it to incorporate the user's menu choice, and take them straight to the relevant page on the mobile version, by appending the value of $_GET to the redirect address string.
My code is:
Unfortunately if $_GET['p'] has a value, I get a 'Moved Permanently' page error. Any thoughts about why this is?
$mob_link = 'Location: mobile/christmas2012m.php';
if ($_GET['p']) $mob_link = $mob_link + '?p=' + $_GET['p'];
header($mob_link, true, 301);
+ is an arithmetic operator. Dot ( . ) is the concatenation operator. Try changing that and see what happens.
Also note, according to RFC2616-sec14
Originally Posted by w3.org
Awesome, that's it. Obvious once someone points it out - thanks!
Users Browsing this Thread
There are currently 1 users browsing this thread. (0 members and 1 guests)