301 redirect old wordpress urls to new cakephp urls

I’m having some troubles redirecting my old sites blog posts from wordpress to the new cakephp formatted urls

I have 13 posts so it’s not that many, I am trying to manually add them to the .htaccess file but they are not redirecting when you try to access them.

Read More

Her is an example of what I am trying

Redirect 301 /blog.php?freedom-church-chosen-experience /blog/post/10e-freedom-church-chosen-experience

There was some weird ajax stuff going on so that’s why the ? in the previous url. But when I try to go to the old blog post url, it’s not forwarding to the new one. We deleted the old site and pushed up the new cakephp site so those pages do not exist.

I have also added this to the app/.htaccess file as per an article I found here

http://www.davidtan.org/cakephp-tutorial-htaccess-redirect-301-rules-tips/

But I’ve tried a few different things and I can’t get it to redirect.

Related posts

Leave a Reply

1 comment

  1. You cannot match QUERY_STRING using RewriteRule. Just use this rule on top of your root .htaccess:

    RewriteEngine On
    
    RewriteCond %{QUERY_STRING} (?:^|&)(freedom-church-chosen-experience) [NC]
    RewriteRule ^blog.php$ /blog/post/10e-%1? [L,R=301,NC]