【发布时间】:2015-10-19 22:30:53
【问题描述】:
我看过this question,它描述了如何在nginx中重定向一个url,如下所示
# main server block for www.test.com
server {
listen 80;
server_name www.test.com;
...
}
# redirect test.com to www.test.com
server {
server_name test.com;
return 301 $scheme://www.test.com$request_uri;
}
我需要做的是重定向一组单独的页面,所以想知道如何做到这一点
例如test.com\index , test.com\home , test.com\main 到 test.com\index.php
然后我有一些其他页面可以简单地重定向到 .php 扩展名
例如test.com\about 转 \test.com\about.php
例如test.com\contact 转 \test.com\contact.php
最好的方法是什么?
【问题讨论】:
标签: nginx