我使用 nginx 和 php-fpm 来托管我的 wordpress 网站,我对 slug 有一个大问题:
当我用媒体插件写一个带有一些法语特殊字符的图片名称时,nginx 会给我一个 404。
http://example.com/wp-content/uploads/2013/05/Collier -éléphant-bois-os-argent-300x300.jpg -> 返回 404
和
http://example.com/wp-content/uploads/2013/05/Collier-%C3%A9l%C3%A9phant-bois-os-argent-350x350.jpg -> 返回 404
该文件位于 /wp-content/uploads/2013/05/ 目录并命名为 Collier-éléphant-bois-os-argent-300x300.jpg
你能帮我修一下吗?
nginx的配置:
server {
charset UTF-8;
## Your website name goes here.
server_name example.com www.example.com;
access_log /var/log/nginx/example.com.access.log;
error_log /var/log/nginx/example.com.error.log;
## Your only path reference.
root /var/www/example.com/www/htdocs/;
index index.php index.html;
server_name_in_redirect off;
port_in_redirect off;
location ~* ^.+\.(jpg|jpeg|gif|css|png|js|ico)$ {
access_log off;
expires 30d;
}
# rewrite rules
location / {
if (!-e $request_filename) {
rewrite ^/(.*)$ /index.php?q=$1 last;
}
}
location ~ \.php$ {
fastcgi_pass phpfcgi;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include fastcgi_params;
}
}
亲切地,