Welcome Guest, Not a member yet? Register   Sign In
Remapping Wordpress URLs using routes, not htaccess

[eluser]Daniel H[/eluser]
Hi all,

I'm about to migrate a site from wordpress to a bespoke system. I have migrated the wordpress articles almost field for field to the new system, so that the url title remains the same.

So, what I'd like to do programmatically (i.e. not using htaccess) is to take this url:


and map it to


by way of having a route which specified if the URL of the latter type is found, map it to a controller/function called blog/wordpress. The wordpress function will then query the db using url-title, and redirect to the correct post.

However routes really confuse me and I'm not sure what the best way to do this is - please can someone suggest how to do this?


Something like:-

$route['(:num)/(:num)/(:num)/(:any)'] = "blog/wordpress/$4"


Someone with far better sense of regular expression can probably get a better match for the 3 number parts!

Hope this helps, or someone else steps in to tell me i'm giving rubbish advice Smile


[eluser]Daniel H[/eluser]
That is precisely what I have just done, so it must be right. ;-)

Thanks a lot!

Theme © iAndrew 2016 - Forum software by © MyBB