【发布时间】:2013-06-26 20:02:32
【问题描述】:
我有以下重写规则
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
到
这个网址有问题
https://example.com/product/one/two/three/four/test_file.xml
请推荐?
谢谢!
【问题讨论】:
-
请提供您的源 URL 和目标 URL 的一些示例。
-
@anubhava 问题更新了示例
标签: regex apache url mod-rewrite