使用“畸形双?”重定向
我尝试以下操作:必须保持活动的旧 URL 形成如下:/index.php?id=5041?var1=val1&var2=val2&var3=val3
我必须把它重定向到这样的东西:
/path1/path2/?id=1234?var1=val1&var2=val2&var3=val3
无论我尝试什么 - 它要么是 index.php 中的无限循环,要么是在 id 之后切断其余的 var。其余的字符串应该简单地连接。
IE。
#Only if id = 1234
RewriteCond %{QUERY_STRING} ^id=1234? [NC]
#get id for variable $1
RewriteCond %{QUERY_STRING} id=(\d+) [NC]
#get rest for variable $2
RewriteCond %{QUERY_STRING} val1=(\d+) [NC]
RewriteRule ^index\.php$ /path1/path2/?myid=%1&val2=%2