tags:

views:

9

answers:

1

Hello

I have this rule on my .htaccess file

RewriteRule ^business/(.*)/(.*)/(.*)$ ./businesspage.php?name=$1&place=$2&id=$3

I want to make it shorter for SEO purposes, so there would be only two parameters, $3 & $1.

However, I want the old URLs indexed on google to redirect to the new ones. How do I do it?

For example /business/name/place/id -> /id/name.

Thanks

+1  A: 

Something like this above your existing rule should work for the redirection:

RewriteRule ^business/([^/]+)/[^/]+/([^/]+)$ /$2/$1 [R=301,L]

Then I assume you also want to modify your existing rule like this:

RewriteRule ^([^/]+)/([^/]+)$ /businesspage.php?name=$2&id=$1
Tim Stone
Thanks!I had that idea in mind, just didn't know how to write it.
Itay