Apache .htaccess在源URL和目标URL中具有查询参数的URL重定向语法
我有一个IIS重定向规则,它可以完美地工作。我一直在尝试将其转换为.htaccess格式,以便在live web主机上使用,但收效甚微 该规则的目的是重定向对url的任何访问Apache .htaccess在源URL和目标URL中具有查询参数的URL重定向语法,apache,.htaccess,redirect,mod-rewrite,Apache,.htaccess,Redirect,Mod Rewrite,我有一个IIS重定向规则,它可以完美地工作。我一直在尝试将其转换为.htaccess格式,以便在live web主机上使用,但收效甚微 该规则的目的是重定向对url的任何访问 http://my.web.host/user/username/?profiletab=main 到url http://my.web.host/network/?user=username 规则的IIS web.config格式如下所示: <rule name="bounce" patternSyntax="EC
http://my.web.host/user/username/?profiletab=main
到url
http://my.web.host/network/?user=username
规则的IIS web.config格式如下所示:
<rule name="bounce" patternSyntax="ECMAScript" stopProcessing="true">
<match url="^user/(.*)/$" />
<conditions logicalGrouping="MatchAll" trackAllCaptures="false">
<add input="{QUERY_STRING}" pattern="profiletab=main" />
<add input="{QUERY_STRING}" pattern="um_action" negate="true" />
</conditions>
<action type="Redirect" url="/network/?user={R:1}" appendQueryString="false" redirectType="Found" />
</rule>
两者都不起作用。因此,我非常感谢您对实现上述重定向所需的语法提供帮助。(我希望我至少很接近!)
各位,先谢谢你们 您可以将此规则用作.htaccess中的第一条规则:
RewriteEngibe On
RewriteCond %{QUERY_STRING} (?:^|&)profiletab= [NC]
RewriteRule ^user/([\w-]+)/?$ /network/?user=$1 [QSA,R=301,L]
是的,谢谢,它为工作结果提供了基础。谢谢你的帮助,先生!
RewriteEngibe On
RewriteCond %{QUERY_STRING} (?:^|&)profiletab= [NC]
RewriteRule ^user/([\w-]+)/?$ /network/?user=$1 [QSA,R=301,L]