There are questions remain, We'll search for the answers together. But one thing we known for sure,the future is not set!

【原创文章】nginx中将所有的访问指向一个页面

系统防护 百蔬君 2296℃ 已收录 0评论

 

修改nginx中网站的配置文件,比如baishujun.com.conf,

在server_name关键词下面添加一个rewrite重定向。

server_name nkbaishu.com www.nkbaishu.com;
index index.php index.html;
rewrite ^(.*)$ /index.html break;

这样所有的访问将指向根目录下面的index.html.break的意思是匹配到这里之后就终止,不再继续往下匹配其它任何规则。

 

 

 

转载请注明:百蔬君 » 【原创文章】nginx中将所有的访问指向一个页面

喜欢 (2)or分享 (0)
发表我的评论
取消评论

请证明您不是机器人(^v^):

表情