最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

php - WordpressNGINX not respecting the category URL for new posts

programmeradmin1浏览0评论

Only recently noticed this issue with my site configurations, it seems as though on my NGINX Wordpress sites the category base of a URL is not being respected and instead being redirected to another category which uses the same post_name slug as the new post. This results in me unable to make any unique name posts since it's ignoring the category base entirely!

I'm not entirely sure why this is the case and would love if someone could help with this. Details below.

An example expected scenario

=> will go to /category-1/post-1 => will go to /category-2/post-1

Current scenario

=> will go to /category-1/post-1 => will go to /category-1/post-1

Any new posts will produce the following

=> post exists at /category-1/post-1 => new post created with exists at /category-2/post-1-2 extension

My settings in the permalinks for Wordpress

My NGINX configurations for /location is below

    location / {
    # First attempt to serve request as file, then
    # as directory, then fall back to displaying a 404.
    # break if URI has .html extension
    if ($request_filename ~* ^.+.html$) {
      break;
    }
    # add .html to URI and serve file, directory, or symlink if it exists
    if (-e $request_filename.html) {
      rewrite ^/(.*)$ /$1.html last;
      break;
    }


    try_files $uri $uri/ /index.php?q=$uri&$args; 

#   try_files $uri $uri/ =404;

}
发布评论

评论列表(0)

  1. 暂无评论