Skip to main content
added 89 characters in body
Source Link
Mr.Bhat
  • 111
  • 3

Wordpress home pageWhen permalink is set to plain everything works perfectly fine,. but for other pages when I change wordpress permalink from plain to post name only Wordpress home page(dev.site.com/blog) works fine, but for other pages(e.g., dev.site.com/blog/first-page) it will be redirected to dev.site.com.

server {
    listen 80;
    listen [::]:80;

    root /var/www/wordpress-site;
    index index.php index.html index.htm index.nginx-debian.html;

    server_name dev.site.com www.dev.site.com;

    location = /favicon.ico { log_not_found off; access_log off; }
    location = /robots.txt { log_not_found off; access_log off; allow all; }

    location /blog {
            alias /var/www/wordpress-site/;
            try_files $uri $uri/ /blog/index.php?$args;

            location ~ \.php$ {
                    include snippets/fastcgi-php.conf;
                    include fastcgi_params;
                    fastcgi_pass unix:/var/run/php/php7.2-fpm.sock;
                    fastcgi_param SCRIPT_FILENAME $request_filename;
            }
    }
    
    # angular project

    location / {
            root /home/user/angular-project;
            try_files $uri $uri/ /index.html;
    }

    location ~ /\.ht { deny all; }
}

I tried changing try_files, but still doesn't work

Thank you :)

Wordpress home page works perfectly fine, but for other pages when I change wordpress permalink from plain to post name page will be redirected to dev.site.com.

server {
    listen 80;
    listen [::]:80;

    root /var/www/wordpress-site;
    index index.php index.html index.htm index.nginx-debian.html;

    server_name dev.site.com www.dev.site.com;

    location = /favicon.ico { log_not_found off; access_log off; }
    location = /robots.txt { log_not_found off; access_log off; allow all; }

    location /blog {
            alias /var/www/wordpress-site/;
            try_files $uri $uri/ /blog/index.php?$args;

            location ~ \.php$ {
                    include snippets/fastcgi-php.conf;
                    include fastcgi_params;
                    fastcgi_pass unix:/var/run/php/php7.2-fpm.sock;
                    fastcgi_param SCRIPT_FILENAME $request_filename;
            }
    }
    
    # angular project

    location / {
            root /home/user/angular-project;
            try_files $uri $uri/ /index.html;
    }

    location ~ /\.ht { deny all; }
}

I tried changing try_files, but still doesn't work

Thank you :)

When permalink is set to plain everything works fine. but when I change permalink to post name only Wordpress home page(dev.site.com/blog) works fine, but for other pages(e.g., dev.site.com/blog/first-page) it will be redirected to dev.site.com.

server {
    listen 80;
    listen [::]:80;

    root /var/www/wordpress-site;
    index index.php index.html index.htm index.nginx-debian.html;

    server_name dev.site.com www.dev.site.com;

    location = /favicon.ico { log_not_found off; access_log off; }
    location = /robots.txt { log_not_found off; access_log off; allow all; }

    location /blog {
            alias /var/www/wordpress-site/;
            try_files $uri $uri/ /blog/index.php?$args;

            location ~ \.php$ {
                    include snippets/fastcgi-php.conf;
                    include fastcgi_params;
                    fastcgi_pass unix:/var/run/php/php7.2-fpm.sock;
                    fastcgi_param SCRIPT_FILENAME $request_filename;
            }
    }
    
    # angular project

    location / {
            root /home/user/angular-project;
            try_files $uri $uri/ /index.html;
    }

    location ~ /\.ht { deny all; }
}

I tried changing try_files, but still doesn't work

Thank you :)

Updated redirect site from site.com to dev.site.com
Source Link
Mr.Bhat
  • 111
  • 3

Wordpress home page works perfectly fine, but for other pages when I change wordpress permalink from plain to post name page will be redirected to wwwdev.site.com.

server {
    listen 80;
    listen [::]:80;

    root /var/www/wordpress-site;
    index index.php index.html index.htm index.nginx-debian.html;

    server_name dev.site.com www.dev.site.com;

    location = /favicon.ico { log_not_found off; access_log off; }
    location = /robots.txt { log_not_found off; access_log off; allow all; }

    location /blog {
            alias /var/www/wordpress-site/;
            try_files $uri $uri/ /blog/index.php?$args;

            location ~ \.php$ {
                    include snippets/fastcgi-php.conf;
                    include fastcgi_params;
                    fastcgi_pass unix:/var/run/php/php7.2-fpm.sock;
                    fastcgi_param SCRIPT_FILENAME $request_filename;
            }
    }
    
    # angular project

    location / {
            root /home/user/angular-project;
            try_files $uri $uri/ /index.html;
    }

    location ~ /\.ht { deny all; }
}

I tried changing try_files, but still doesn't work

Thank you :)

Wordpress home page works perfectly fine, but for other pages when I change wordpress permalink from plain to post name page will be redirected to www.site.com.

server {
    listen 80;
    listen [::]:80;

    root /var/www/wordpress-site;
    index index.php index.html index.htm index.nginx-debian.html;

    server_name dev.site.com www.dev.site.com;

    location = /favicon.ico { log_not_found off; access_log off; }
    location = /robots.txt { log_not_found off; access_log off; allow all; }

    location /blog {
            alias /var/www/wordpress-site/;
            try_files $uri $uri/ /blog/index.php?$args;

            location ~ \.php$ {
                    include snippets/fastcgi-php.conf;
                    include fastcgi_params;
                    fastcgi_pass unix:/var/run/php/php7.2-fpm.sock;
                    fastcgi_param SCRIPT_FILENAME $request_filename;
            }
    }
    
    # angular project

    location / {
            root /home/user/angular-project;
            try_files $uri $uri/ /index.html;
    }

    location ~ /\.ht { deny all; }
}

I tried changing try_files, but still doesn't work

Thank you :)

Wordpress home page works perfectly fine, but for other pages when I change wordpress permalink from plain to post name page will be redirected to dev.site.com.

server {
    listen 80;
    listen [::]:80;

    root /var/www/wordpress-site;
    index index.php index.html index.htm index.nginx-debian.html;

    server_name dev.site.com www.dev.site.com;

    location = /favicon.ico { log_not_found off; access_log off; }
    location = /robots.txt { log_not_found off; access_log off; allow all; }

    location /blog {
            alias /var/www/wordpress-site/;
            try_files $uri $uri/ /blog/index.php?$args;

            location ~ \.php$ {
                    include snippets/fastcgi-php.conf;
                    include fastcgi_params;
                    fastcgi_pass unix:/var/run/php/php7.2-fpm.sock;
                    fastcgi_param SCRIPT_FILENAME $request_filename;
            }
    }
    
    # angular project

    location / {
            root /home/user/angular-project;
            try_files $uri $uri/ /index.html;
    }

    location ~ /\.ht { deny all; }
}

I tried changing try_files, but still doesn't work

Thank you :)

edited tags
Link
fuxia
  • 107.1k
  • 38
  • 255
  • 459
Source Link
Mr.Bhat
  • 111
  • 3
Loading