繁体   English   中英

WordPress%postname%permalink返回404

[英]WordPress %postname% permalink returns 404

我有一个WordPress博客托管在一个名为/blog的子目录中,我试图使用%postname%字符串来获得非常永久链接,但它只是返回404错误。

我尝试了很多解决方案试图解决这个问题,但没有一个有效。 我错过了什么或者有更好的方法来解决这个问题吗? 在这一点上,我唯一能想到的是权限问题,但这是不太可能的。

我的NGINX配置文件如下:

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

        # SSL configuration
        #
        # listen 443 ssl default_server;
        # listen [::]:443 ssl default_server;
        #
        # Note: You should disable gzip for SSL traffic.
        # See: https://bugs.debian.org/773332
        #
        # Read up on ssl_ciphers to ensure a secure configuration.
        # See: https://bugs.debian.org/765782
        #
        # Self signed certs generated by the ssl-cert package
        # Don't use them in a production server!
        #
        # include snippets/snakeoil.conf;

        root /var/www/allamericangold.com/html/blog;

        # Add index.php to the list if you are using PHP
        index index.php index.html index.htm index.nginx-debian.html;

server_name allamericangold.com www.allamericangold.com 104.198.9.91;

        location / {
                # First attempt to serve request as file, then
                # as directory, then fall back to displaying a 404.
                #try_files $uri $uri/ =404;
                try_files $uri $uri/ /index.php$args;
        }

        location /blog/ {

                try_files $uri $uri/ /blog/index.php$is_args$args;
}
        location ~ \.php$ {
                      include snippets/fastcgi-php.conf;

                # With php7.0-cgi alone:

                # With php7.0-fpm:
                fastcgi_pass unix:/run/php/php7.0-fpm.sock;
        }
}

添加index index.php index.html index.htm; 内部location /blog/块。

location /blog/ {
     index  index.php index.html index.htm;
     try_files $uri $uri/ /blog/index.php$is_args$args;
}

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM