Is there a way I can 301 redirect http://www.domain.com/static.php?userid=123 http://www.domain.com/static.php?userid=12 http://www.domain.com/static.php?userid=122 http://www.domain.com/static.php?userid=1232 now is there a way I could 301 redirect all them urls to just (no matter what dynamic url it is, like redirect anyone) http://www.domain.com/static.php but at the same time be able to get the userid post? through php?
First set a cookie then redirect: $userid=$_GET["userid"]; setcookie("userid", $userid, time()+3600, "/", ".domain.com", 0); //1 hour cookie header("HTTP/1.1 301 Moved Permanently"); header("Location: http://www.domain.com/static.php"); exit(); Code (markup): Now you can check the cookie: if (isset($_COOKIE["userid"])) { //do something } else { // do something else } Code (markup):