I have created a rewrite rule which works fine. I tried to do a php redirect from the old dynamic page to the new static looking page but this gave an infinite loop. How can I get round this? the reason I am using php to redirect instead if doing the redirect in mod rewite is the old url's have a + in them which I wan to convert to a - for the new url. Many thanks.
OK my htaccess looks like this: Options +FollowSymLinks RewriteEngine on RewriteRule repairers/(.*)/(.*)/$ /repairers.php3?$1=$2 HTML: which works fine. How do I redirect the old page to the new page? I tried to add the following to the top of the page but this obviously gets stuck in a loop. I am sure there is a standard way to do this but don't know it. if($name!=""){ $repname = str_replace("+", "-", $name); header("HTTP/1.1 301 Moved Permanently"); header("Location: http://www.noblemarine.co.uk/repairers/name/$repname/"); exit(); } PHP:
I stink at php. I would just use mod_rewrite to redirect it. Options +Indexes Options +FollowSymlinks RewriteEngine on RewriteBase / RewriteRule ^repairers.php3?$1=$2$ http://www.domain.com/repairers/(.*)/(.*)/ [R=301,L] Is both the old and new URL using the same script, with header("HTTP/1.1 301 Moved Permanently"); header("Location: http://www.noblemarine.co.uk/repairers/name/$repname/"); in it? If it is, the new URL also generates that, probably causing it to flip out, old URL, no, new URL, no, new URL, no new URL...
Problem solved- thanks for the assistance. For anybody else doing the same the simplest way to do this was to not try to use the same script to handle both the old url and the new, rewritten url.