[Gllug] mod rewrite - regex replace

Sean Burlington sean at practicalweb.co.uk
Sun Dec 7 17:31:29 UTC 2008


quick question for the mod rewrite gurus :-)

I have an old blog - I've moved some of the content to me newer site and 
want to redirect any traffic from the old site to the new site using the 
  site search function

So far I have:

RewriteEngine On
RewriteRule .*/(.*)/ http://www.practicalweb.co.uk/search/node/$1 [L]

This works OK as far as it goes

hits on

http://www.uncertainty.org.uk/wordpress/2008/01/03/techie/version-control-and-drupal/

end up at

http://www.practicalweb.co.uk/search/node/version-control-and-drupal

But I'd like to get to here

http://www.practicalweb.co.uk/search/node/version+control+and+drupal

Is there any way to change the url ?

$1 = preg_replace('/-/\+/', $1); # in php speak

Can I do this in mod_rewrite?

If not I guess I can adapt my search page ..

-- 

Sean Burlington

www.practicalweb.co.uk
-- 
Gllug mailing list  -  Gllug at gllug.org.uk
http://lists.gllug.org.uk/mailman/listinfo/gllug




More information about the GLLUG mailing list