您好,请参考下述配置文件,根据实际情况修改使用
- server {
- listen 80;
- server_name a.com;
- location / {
- if ($request_uri !~* ^/123\.html$) {
- rewrite ^ http://www.a.com$request_uri permanent;
- }
- }
- }
复制代码
这个配置的含义是:
当请求根目录 / 或除了 /123.html 之外的任何其他路径时,将进行重定向到 www.a.com。
如果请求的是 /123.html,则不会进行重定向。 |
|