Forum Moderators: phranque
We're switching to a different system and moving all these posts to new pages that will look like this:
http://www.example.com/blog/description/post_name/
What's the best way to redirect the 100 old pages to the new ones?
Here's my thought:
In http://www.example.com/folder/, put an .htaccess file in with 100 lines like this:
RewriteRule ^2009/11/post.html$ http://www.example.com/blog/description/post_name/ [NC,R=301,L]
I'd rather not redirect 100 pages like this, but can't think of a better way. Any ideas?
I'm not being specific here about what script you use or which database you access because I don't know how flexible your blog script and database are, or whether you'd want to modify them. If not, then you can 'build your own' script and database or lookup table.
Also, if you have server config access permissions, look at mod_rewrite's RewriteMap directive and the syntax for 'calling' a rewritemap from a RewriteRule directive -- It's sometimes handy for this kind of problem.
Jim
If we were to do this manually and create a .htaccess file with the 100 redirects in example.com/folder, would that be completely unwieldy? It would be a big file, but the only time it would get used is when people are trying to access our old links.
Longer term I would rewrite those URL requests to a simple script you build yourself, and that script would look up the new URL in a database table that you build yourself. You can then have a simple way to maintain that table over time.
Longer term I would rewrite those URL requests to a simple script you build yourself, and that script would look up the new URL in a database table that you build yourself. You can then have a simple way to maintain that table over time.