我有以下重寫規則mod_rewrite的URL(在第二部分條件)
RewriteRule ^/product/([^/]*)/([^/]*)/([^/]*)/([^/]*)/((test_data|data_test)/)?([^/]*)$ /product/?query_one=$1&query_two=$2&query_three=$3&query_four=$4&file_path=$6/$7
在最後file_path
的價值,我結合$6/$7
。
如果$6
沒有值,那麼file_path
只會是$7
?我不想/
ID $6
是無。簡單地說,我想把條件放在這部分。
編輯
https://example.com/product/one/two/three/four/test_data/file.jar
TO
問題是這個網址
https://example.com/product/one/two/three/four/test_file.xml
請建議?
謝謝!
請提供您的源和目標URL的一些例子。 – anubhava
@anubhava問題用例子更新 – Ahsan