我有多重URL重定向,我需要從301重定向?Dymanic URL htaccess 301重定向
RewriteRule ^car/([^/]+)/model-([^/]+)-([0-9]+)/$ new_car.php? model=$1&name=$2&year=$3 [QSA,L]
我有多重URL重定向,我需要從301重定向?Dymanic URL htaccess 301重定向
RewriteRule ^car/([^/]+)/model-([^/]+)-([0-9]+)/$ new_car.php? model=$1&name=$2&year=$3 [QSA,L]
您可以使用下列內容:
#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]
我有最後一個問題,如何在這個url的末尾添加像&page = 2這樣的分支? –
&page = 2是查詢字符串的一部分,如果請求的網址是**/cars/foo/bar /?page = 2,QSA標誌會自動將其附加到舊網址** – starkeen
是否有可能通過重定向? –
到底是什麼問題了嗎? – starkeen
我需要重定向301從舊的URL到新的工作 –
你的意思是 'new_car.php?模型= $ 1&name = $ 2&year = $ 3' ** to **'car /([^ /] +)/ model - ([^ /] +) - ([0-9] +)/ $'? – starkeen