开发者

redirecting old rewrite rule into a new one

开发者 https://www.devze.com 2023-01-11 19:18 出处:网络
I have this rule on my .htaccess file RewriteRule ^business/(.*)/(.*)/(.*)$ ./businesspage.php?name=$1&place=$2&id=$3

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 U开发者_StackOverflow社区RLs indexed on google to redirect to the new ones. How do I do it?

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

Thanks


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
0

精彩评论

暂无评论...
验证码 换一张
取 消