简体   繁体   English

WordPress的永久链接问题-额外的永久链接中的额外“ index.php”

[英]Wordpress Permalink Issue - extra “index.php” in pretty permalink

I migrated my site from Apache to Nginx,the problem now is my permalinks have an extra index.php in the URL, I am not able to determine if this is a wordpress issue or my configuration issue. 我将网站从Apache迁移到Nginx,现在的问题是我的永久链接的URL中有一个额外的index.php,我无法确定这是wordpress问题还是我的配置问题。

Example when my post is rendered the original link: http://hs.com/2012/04/30/a-new-question/ is now being linked as http://hs.com/ * index.php/ *2012/04/30/a-new-question/ 呈现我的帖子时的原始链接示例: http : //hs.com/2012/04/30/a-new-question/现在链接为http://hs.com/ * index.php / * 2012 / 04/30 /一个新问题/

I tried the nginx compatibility plug in.. also tried the custom structure options with and without the plug in and I am just not able to understand what is going on. 我尝试了nginx兼容性插件。也尝试了带有和不带有插件的自定义结构选项,但我只是无法理解发生了什么。 Wordpress says that the custom permalink structure is saved, even then all links in the site are rendered incorrectly. Wordpress说,自定义的永久链接结构已保存,即使站点中的所有链接都呈现不正确。

Here is my nginx configuration for the site. 这是我对该站点的nginx配置。

server {
server_name harshasagar.com www.harshasagar.com;
access_log /srv/www/harshasagar.com/logs/access.log;
error_log /srv/www/harshasagar.com/logs/error.log;
root /srv/www/harshasagar.com/public_html;

if ($host ~* www\.(.*)) {
   set $host_without_www $1;
   rewrite ^(.*)$ http://$host_without_www$1 permanent; # $1 contains '/foo', not 'www.mydomain.com/foo'
}

location / {
    index index.html index.htm index.php;
    try_files $uri $uri/ /index.php?q=$uri&$args;
}

location ~ \.php$ {
    try_files $uri =404;
    include fastcgi_params;
    fastcgi_pass  127.0.0.1:9000;
    fastcgi_index index.php;
    fastcgi_param SCRIPT_FILENAME /srv/www/harshasagar.com/public_html$fastcgi_script_name;
}

Replace line: 替换行:

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

with

try_files $uri $uri/ /index.php?$args;

And install this plugin - http://wordpress.org/extend/plugins/nginx-helper/ 并安装此插件-http: //wordpress.org/extend/plugins/nginx-helper/

If you face issue after that please let me know. 如果您之后遇到问题,请告诉我。

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

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