【发布时间】:2018-04-14 20:09:59
【问题描述】:
我继承了 WordPress 项目,帖子中的所有媒体(图像)看起来像这样:
http://example.com/image/news/name.jpg
即使站点的根设置为http://example.com/news
并且图片实际上保存在wp-content/uploads/2017...中
现在我把这个网站从共享主机移到我自己的服务器上,我试图通过如下所示的 nginx 配置来服务它:
location ^~ /news {
root /var/www/html/;
index index.php index.html index.htm;
try_files $uri $uri/ @wp;
location ~ \.php$ {
include snippets/fastcgi-php.conf;
fastcgi_pass unix:/var/run/php/php7.1-fpm.sock;
fastcgi_param
SCRIPT_FILENAME $document_root$fastcgi_script_name;
}
}
除图片网址外,其他一切都有效。
为什么旧的 URL 看起来和原来的一样?重写它们的是什么?
我该如何使用 nginx 和 /image 位置来解决这个问题?
【问题讨论】:
-
嗨。我添加了一个可能的解决方案。你有机会看看吗?
标签: wordpress