Free Android CakePHP GMaps Articles by Bali Web Design

September 4, 2010

How to redirect wordpress blog url cakephp

Filed under: cakephp,php,wordpress — admin @ 7:15 pm

Cakephp have great routing capability, i was install wordpress blog on my main website root directory. And then i need to move my blog into new folder, i put it on /app/webroot/blog/ because i build new web application on root directory using cakephp.

I use rewriting rule for my wordpress blog. The rule is I want to redirect into I don’t want to loose my blog visitors because the blog posting has good ranking on google.

So i do setting on app/config/routes.php and add this line

Router::connect(‘/:year/:month/:slug’, array(‘controller’ => ‘pages’, ‘action’ => ‘redirect_blog’), array(‘pass’ => array(‘year’, ‘month’, ‘slug’), ‘year’ => ‘[0-9]{4}’, ‘month’ => ‘[0-9]{2}’, ‘slug’ => ‘[A-Za-z0-9-]+’));