0
我有這樣一個URL:.htaccess的查詢字符串鍵重寫而不會改變路徑
example.com/this/that.html?zona=my-zona
,我需要重寫,並做了301:
example.com/this/that.html?loc=my-zona
我需要保持鍵'zona'的路徑和查詢字符串值相同,但我需要將'zona'鍵重寫爲'loc'
我有這樣一個URL:.htaccess的查詢字符串鍵重寫而不會改變路徑
example.com/this/that.html?zona=my-zona
,我需要重寫,並做了301:
example.com/this/that.html?loc=my-zona
我需要保持鍵'zona'的路徑和查詢字符串值相同,但我需要將'zona'鍵重寫爲'loc'
您可以在.htaccess頂部更改此規則:
RewriteEngine On
RewriteCond %{QUERY_STRING} ^zona=([^&]*) [NC]
RewriteRule ^this/that\.html$ %{REQUEST_URI}?loc=%1 [L,NC,R=301]
@ neting.it:這是否工作正常? – anubhava