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以供參考。 –