Dymanic URL htaccess 301重定向

时间:2016-05-29 02:59:38

标签: .htaccess redirect

我有多个网址重定向,我需要制作301重定向?

RewriteRule ^car/([^/]+)/model-([^/]+)-([0-9]+)/$ new_car.php?     model=$1&name=$2&year=$3 [QSA,L]

1 个答案:

答案 0 :(得分:1)

您可以使用以下内容:

#1 301 redirect from  the old location to the new
RewriteCond %{THE_REQUEST} /new_car\.php\?model=([^&]+)&name=([^&]+)&year=([^&\s]+) [NC]
RewriteRule ^ /car/%1/model-%2-%3/? [L,R=301]
#2 internally redirect from  the new location to the old
RewriteRule ^car/([^/]+)/model-([^/]+)-([0-9]+)/?$ new_car.php?     model=$1&name=$2&year=$3 [QSA,L]