我目前正在使用EasyEngine在Nginx服务器上运行IPS社区套件论坛,我一直在尝试找到一种方法将http://example.com/重定向到http://example.com/index.php(仅当它仅仅是here时域)。这是我当前服务器的Nginx配置:
server {
listen 80;
listen 443;
ssl on;
ssl_certificate /var/www/example.com/cert.pem;
ssl_certificate_key /var/www/example.com/key.key;
server_name example.com www.example.com;
access_log /var/log/nginx/example.com.access.log rt_cache;
error_log /var/log/nginx/example.com.error.log;
root /var/www/example.com/htdocs;
index index.php index.html index.htm;
include common/wpfc.conf;
include common/wpcommon.conf;
include common/locations.conf;
include /var/www/classicaddons.com/conf/nginx/*.conf;
}
任何帮助都会受到赞赏!
答案 0 :(得分:1)
试试这个:
if ($request_uri = "/") {
return 301 "/index.php";
}
您可以在包含其他文件之前添加此内容。
答案 1 :(得分:1)
您可以使用完全匹配location
块。有关详情,请参阅this document。
location = / {
return 301 /index.php;
}