homepage Welcome to WebmasterWorld Guest from 54.205.99.71
register, free tools, login, search, pro membership, help, library, announcements, recent posts, open posts,
Become a Pro Member
Home / Forums Index / Code, Content, and Presentation / Apache Web Server
Forum Library, Charter, Moderators: Ocean10000 & incrediBILL & phranque

Apache Web Server Forum

    
Redirect of complex URL structure to Wordpress
jancek




msg:4517656
 12:16 am on Nov 10, 2012 (gmt 0)

I would like to migrate my website with homemade CMS to Wordpress. My website has thousands of URLs in some patterns. Most of them look like www.example.com/something.php?id=XXX Is there any possibility to redirect these old URLs to Wordpress URLs? I haven't found any solution on this.

First I thought I could use IDs of old URLs. I could use old IDs as IDs of posts in Wordpress. I am afraid that it will not be that easy.

Thank you in advance for any advice!

 

lucy24




msg:4517684
 1:53 am on Nov 10, 2012 (gmt 0)

Before you start, you have to find out what the equivalent Wordpress URL would be if the pages had been made in wordpress in the first place. And then you can figure out if they can be redirected in one step-- either via htaccess alone, or by detouring to a php script. The one thing you need to avoid at all costs is a double redirect. (Someone else hereabout said: the choice between an ugly url and a double redirect is like choosing between plague* and cholera. I firmly intend to steal this line and use it at every opportunity.)

You will also have to be careful with your htaccess, because any cms intallation-- including wordpress-- comes with its own htaccess. It main purpose is to rewrite the pretty wordpress urls to the "real" location of the information.

:: pause here for heated argument spanning next six posts ::

OK, still with us? If you can give your old pages the exact same URL that wordpress would have given them, they'll get scooped up in the same rewrite. Otherwise you'll have to code a separate rewrite, and be very very very careful that it doesn't conflict with wordpress's own rewrite.


* He actually said "pest", but that's a non-native-speaker thing.

g1smd




msg:4517737
 8:19 am on Nov 10, 2012 (gmt 0)

This sounds like you need the "rewrite (that's rewrite, not redirect) the old requests to a special PHP script that looks up the new URL (either from an array or a db table) and then uses the HEADER directive to 301 redirect to the new wordpress URL" solution. It's been discussed a few times before and some of those threads have example code to get started.

Global Options:
 top home search open messages active posts  
 

Home / Forums Index / Code, Content, and Presentation / Apache Web Server
rss feed

All trademarks and copyrights held by respective owners. Member comments are owned by the poster.
Home ¦ Free Tools ¦ Terms of Service ¦ Privacy Policy ¦ Report Problem ¦ About ¦ Library ¦ Newsletter
WebmasterWorld is a Developer Shed Community owned by Jim Boykin.
© Webmaster World 1996-2014 all rights reserved