1
我将我的网站从Apache迁移到Nginx,现在的问题是我的永久链接在URL中有一个额外的index.php,我无法确定这是否一个WordPress的问题或我的配置问题。WordPress的永久链接问题 - 额外的“index.php”在漂亮的永久链接
例如,当我的帖子呈现原文链接:http://hs.com/2012/04/30/a-new-question/ 现在被链接为http://hs.com/ * 的index.php/ * 2012/04/30/A-新的问题/
我试过nginx的兼容性插件..也尝试了使用和不使用插件的自定义结构选项,我只是无法理解发生了什么。 WordPress的说,自定义的永久链接结构已保存,即使该网站中的所有链接都呈现不正确。
这是我对该网站的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;
}
您的位置实际上是正确的。我的建议是错误的。我正在想别的东西。答案已删除。请参阅http://wiki.nginx.org/Pitfalls以供参考。 –