2017-09-08 39 views

回答

0

可以使用MOD-別名(RedirectMatch)指令該重定向:

RedirectMatch ^/path1/path2/path3/?$ http://example.com/static/path1/path2/path3 

如果舊的URI是中對動態,你可以使用正則表達式來處理:

RedirectMatch ^/(path1/.+)$ http://example.com/static/$1 

第一個重定向將重定向/path1/path2/path3/static/path1/path2/path3和第二個重定向將重定向/path1/foo/bar/static/foo/bar

如果你想使用國防部重寫,您可以使用以下規則:

RewriteEngine on 

RewriteRule ^/?(path1/.+)$ http://example.com/static/$1 [L,R] 
+0

輸出,我需要前三PARAMS和最後PARAM。中間有 – jayanth

+0

可以有任何路徑。 – jayanth

+0

嘗試:** RedirectMatch^/(path1 /[^/]+/[^/]+)/.+/([^/]+)/?$ http://example.com/static/$1/$2 ** – starkeen

0
RewriteEngine on 
RewriteRule ^/([a-zA-Z0-9_-]+)/([a-zA-Z0-9_-]+)/([a-zA-Z0-9_-]+)/.*/(.*)$ http://example.com/product/$1/$2/$3/$4 
+0

這是爲我工作。 – jayanth