www.webdeveloper.com
Results 1 to 3 of 3

Thread: PHP Header Redirect

  1. #1
    Join Date
    Feb 2005
    Location
    Norwich, UK
    Posts
    138

    PHP Header Redirect

    Hi,
    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:
    Code:
    $mob_link = 'Location: mobile/christmas2012m.php';
    		if ($_GET['p']) $mob_link = $mob_link + '?p=' + $_GET['p'];
    		header($mob_link, true, 301);
    		exit;
    Unfortunately if $_GET['p'] has a value, I get a 'Moved Permanently' page error. Any thoughts about why this is?
    _____________________________________________

    http://www.djillustration.com

  2. #2
    Join Date
    Oct 2010
    Location
    Ohio
    Posts
    233
    + is an arithmetic operator. Dot ( . ) is the concatenation operator. Try changing that and see what happens.

    Also note, according to RFC2616-sec14
    Quote Originally Posted by w3.org
    The field value consists of a single absolute URI.
    ~Ryan
    www.rdennispallas.com <-- Personal Site, changing regularly cuz its ugly.

  3. #3
    Join Date
    Feb 2005
    Location
    Norwich, UK
    Posts
    138

    resolved

    Awesome, that's it. Obvious once someone points it out - thanks!
    _____________________________________________

    http://www.djillustration.com

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center



Recent Articles