I recently changed my site so that it now uses static urls as opposed to dynamic ones. I've been trying to figure out a way within .htaccess to direct the old dynamic urls to the new static ones. The problem I have is that there really is no pattern that corresponds the old to the new so I don't think I can use a mod_rewrite. I'm trying to use just a standard 301 redirect but I can't figure out how to do it with dynamic urls. Here's an example of the urls: old: http://www.mysite.com/productpage.php?productid=1&productname=widget1&catname=bluewidgets new: http://www.mysite.com/my-widgets-page.php Anyone have any ideas?
If productpage.php doesn't actually exist, you could use <? switch($_GET['productid']) { case 1 : header("location: http://www.location.of.product1.php"); break; case 2: header("location: http://www.location.of.product2.php"); break; } ?> PHP: Does that page exist ?
I don't currently have the page up but I can add it back to the site. The code you included would be added to productpage.php correct? I would basically have a different case statement for each new url?