admin管理员组文章数量:1389929
When permalink is set to plain
everything works fine. but when I change permalink to post name
only Wordpress home page(dev.site/blog
) works fine, but for other pages(e.g., dev.site/blog/first-page
) it will be redirected to dev.site
.
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 www.dev.site;
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/blog
) works fine, but for other pages(e.g., dev.site/blog/first-page
) it will be redirected to dev.site
.
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 www.dev.site;
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 :)
Share Improve this question edited Apr 1, 2020 at 18:55 Mr.Bhat asked Apr 1, 2020 at 14:33 Mr.BhatMr.Bhat 1113 bronze badges 8 | Show 3 more comments1 Answer
Reset to default 0Try separating the second location block:
location /blog { alias /var/www/wordpress-site/; try_files $uri $uri/ /blog/index.php?$args; }
location ~ \.php$ { fastcgi_split_path_info ^(/blog)(/.*)$; include snippets/fastcgi-php.conf; include fastcgi_params; fastcgi_pass unix:/var/run/php/php7.2-fpm.sock; fastcgi_param SCRIPT_FILENAME $request_filename; }
Hope this helps!
本文标签: 404 errorWordpress postname permalink redirects to sitecom
版权声明:本文标题:404 error - Wordpress post-name permalink redirects to site.com 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1744610449a2615622.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
/
is angular project and/blog
is wordpress – Mr.Bhat Commented Apr 1, 2020 at 15:48post name
page is redirected todev.site
. – Mr.Bhat Commented Apr 1, 2020 at 18:48dev.site
? What kind of redirect is it? This doesn't sound like an Apache issue, it sounds like something in PHP/WordPress is doing this. Disable all plugins and switch to the default theme – Tom J Nowell ♦ Commented Apr 1, 2020 at 21:08