Mosokim
Mosokim

Reputation: 1

I can't change path server name on nginx

I can't change path server name on nginx for example.com to example.com/home1 at (root /var/www/html/public ). please you recommend how to config ? Thank you.

server {
listen       80;
listen      443 ssl;

server_name  example.com;
return 301 http://example.com/home1;

root   /var/www/html/public;
index  index.php index.html index.htm;

location / {
    try_files $uri $uri /index.php?$args;
}

Upvotes: 0

Views: 263

Answers (1)

Orphamiel
Orphamiel

Reputation: 884

/home1 should be in the location selector instead. Remove the equals before /home1 if you want it to match anything with /home1 instead.

server {
    listen       80;
    listen      443 ssl;

    server_name  example.com;

    root   /var/www/html/public;
    index  index.php index.html index.htm;

    location = /home1 {
        try_files $uri $uri /index.php?$args;
    }
}

Upvotes: 1

Related Questions