0

I am currently running an IPS Community Suite forum on an Nginx server using EasyEngine and I have been trying to find a way to redirect http://example.com/ to http://example.com/index.php (only when it's simply the domain). Here is my current Nginx config for the server:

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;
}

Any help would be appreciate!

4

2 回答 2

1

尝试这个 :

if ($request_uri = "/") {
    return 301 "/index.php";
}

您可以在包含其他文件之前添加它。

于 2017-07-10T20:56:34.287 回答
1

您可以使用完全匹配location块。有关更多信息,请参阅此文档

location = / {
    return 301 /index.php;
}
于 2017-07-10T21:01:45.263 回答