Hey guys, I am a .htaccess newbie having a problem with a 301 redirect. I am trying to do a 301 redirect that has a PHP variable, but the redirect is not clean and causing some seo google problems. I am trying to redirect the following: From: http://www.example.com/dog/cat/index.php?pid=13 To: http://www.example.com I have been using this redirect: RedirectMatch 301 /dog/cat/ http://www.example.com That redirectmatch is producing the following result which is not clean and problematic: http://www.example.com/?pid=index.php Any ideas how to fix this? Thanks Jason
Two possible solutions for you: Use RedirectMatch's capture group feature: RedirectMatch /dog/cat/index\.php\?pid=(\d+)$ http://www.example.com/?pid=$1 Code (markup): Use PHP to perform the redirect: <?PHP if ((int) $_GET['pid'] == 13) { die(header("Location: http://www.example.com/", 301)); } ?> PHP: