Forum Moderators: phranque
i'm redesigning a clients website and keen not to loose page rankings.
i'm going to redirect the old pages to the relevant new ones using htaccess
there's a mass of pages.
my question is do i need to redirect each page individualy of is there a nice shortcut i can add.
this is what im thinking, rather than
Redirect 301 /stansfield.htm http://www.example.co.uk/property.php?property_id=118
Redirect 301 /stansfield1.htm http://www.example.co.uk/property.php?property_id=118
Redirect 301 /stansfield2.htm http://www.example.co.uk/property.php?property_id=118
Redirect 301 /stansfield3.htm http://www.example.co.uk/property.php?property_id=118
can i have something like
Redirect 301 /stansfield([a-z\-]+).htm http://www.example.co.uk/property.php?property_id=118
that wasn't happening, but i'm hoping i'm not far away
cheers
mat
[edited by: jdMorgan at 2:03 am (utc) on Aug. 10, 2008]
[edit reason] example.com [/edit]
If you're intent on doing this, then see the Apache mod_alias RedirectMatch documentation, or use mod_rewrite. Either will reduce the number of external redirects you'll have to do.
But for your next project, bear in mind that just because you change filenames does not mean that any of your URLs need to change -- they don't. Take a look at doing URL-to-filename inernal rewrites using mod_rewrite, rather than URL-to-URL external redirects. Also have a look at this short paper [w3.org] by Sir Tim Berners-Lee, inventor of the hyperlink.
Jim
But in case its the business need to get this migration done ... you can use the dot config file in php to change all dynamic url to static (friendly url)
Example:http://www.somesite.co.uk/site.php?section=books&subsection=architecture
to
[somesite.co.uk...]