关于伪静态nginx和Apache的正则表示区别问题?

来源:7-4 Nginx伪静态的实现

赵佳子彧

2019-06-13

Apache中

<IfModule mod_rewrite.c>
            RewriteEngine On    # 打开引擎
            RewriteRule ^(.*).htmp$ index.html   #设置规则,只要以.htmp结尾都跳转到 index.html
 </IfModule>

nginx中

 location / {
        rewrite ^(.*)\.htmp$ /index.html;
        }

关于区别(.htmp)为什么nginx需要(.htmp)反转义一下而Apache不用那?

写回答

1回答

赵佳子彧

提问者

2019-06-13

nginx那个反转义点(\.)加不加斜杠都能跳转到index.html,加不加应该都行吧。

0
1
编程浪子
你好 需要加,这个是说明特殊符号要转义
2019-06-13
共1条回复

快速上手Linux 玩转典型应用

以主流CentOS 7 操作系统为例,系统讲解Linux,真实线上环境助你快速上手,独立配置运维服务器

1663 学习 · 572 问题

查看课程