For Sites: All Sites  * Wordpress   For Browsers: All Browsers  * Firefox  * IE  * Chrome

» Home » Troubleshooter » PHP get – request query string to redirect

PHP get – request query string to redirect

Sometimes you need to redirect your visitors to another page according to information they have entered in a form, or, if you changed an address in your site, you may need to detect a string in the old address and then redirect your visitors to the new address.

This code detects a value called “whatever” and redirects accordingly:

<?php if (array_key_exists('whatever', $_GET)) {
 if ($_GET['whatever'] === '1') {
 header('Location: http://www.thefreewindows.com');
 }
 else if ($_GET['whatever'] === '2') {
 header('Location: http://www.thefreewindows.com/freeware-categories/');
 }
}
?>

And, if you want a permanent redirect add the following line:

header( "HTTP/1.1 301 Moved Permanently" );


Select Windows Freeware   Select Pure Windows Freeware


Related:



Don't miss:   Software Search Plugin   Google Gadget   Amazon Gadget



You are welcome to leave a comment here

This web site is for freeware only; feel yourself free to review an application, recommend it, ask for support - but please note: your post will be deleted if you try to promote a program that is not absolutely free. --

What is 15 + 10 ?
Please leave these two fields as-is:
«

 
»