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

[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:

http://www.mysite.com/2008/11/26/some-url-title/

and map it to

http://www.mysite.com/blog/post/23/some-url-title/

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?

Thanks,
Dan.
#2

[eluser]dijon[/eluser]
Something like:-

Code:
$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

Dan
#3

[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