Created
December 3, 2012 21:42
-
-
Save Koala/4198355 to your computer and use it in GitHub Desktop.
function wl301($var, $zielurl)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Führt 301-Weiterleitung auf angegebenes Ziel aus. | |
* | |
* @param string $var Variable auf die geprueft wird | |
* @param string $zielurl Ziel-URL inkl. http:// | |
*/ | |
function wl301($var, $zielurl) { | |
$url = $_SERVER['REQUEST_URI']; | |
$parts = parse_url($url); | |
if(isset($parts['query'])) { | |
parse_str(urldecode($parts['query']), $partss); | |
if (array_key_exists($var, $partss)) { | |
header("HTTP/1.1 301 Moved Permanently"); | |
header("Location: $zielurl"); | |
header("Connection: close"); | |
} | |
} | |
} | |
wl301('v','http://localhost/aphorismen4_4/index.php?article_id=2'); | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment