我想修改我的.htaccess文件有以下规则:如果URL中包含一个src = website.com并具有参数城市= someCityHere和国家= StateHere去多重定向条件
这个URL传递城市和国家提供的
OR
如果URL中包含的src = website.com和有拉链= zipCodeHere去这个网址传递邮政编码提供
,或者如果没有按URL” t包含src = website.com重定向到thisWebsite.com
例如链接将看起来像这样: www.mywebsite.com/?src=website.com &城市= [城市] &状态= [状态]
或 www.mywebsite的.com /?SRC = website.com &拉链= [拉链]
EDIT
下面是是我有逻辑,但它现在给出了500错误。注意城市和状态值需要通过下划线的重定向URL
RewriteCond %{THE_REQUEST} /\?src=website\.com&city=([^&]+)&state=([^&\s]+) [NC]
RewriteRule^www.anotherwebsite.com/$1_$2? [L,R=301]
RewriteCond %{THE_REQUEST} /\?src=website\.com&zip=([^&]+) [NC]
RewriteRule^www.anotherwebsite.com/$1? [L,R=301]
RewriteCond %{THE_REQUEST} !/\?src=website\.com [NC]
RewriteRule^http://www.anotherwebsite.com [L, R=301]
'%{QUERY_STRING}'不包含问号。几年前我回答了一个类似的问题,请参阅http://stackoverflow.com/q/14307333/1741542 –