我的论坛安装在网址:example.com/论坛上。
我用过nginx和Vanilla来“美化”urls。我设置了
/forum/conf/config.php, “RewriteUrls” to “True”.
在我的nginx.conf中:
location /forums {
index index.php index.htm index.html;
location ~* ^.+.(jpg|jpeg|gif|css|png|js|ico|xml)$ {
access_log off;
log_not_found off;
expires 30d;
}
try_files $uri $uri/ @forums;
}
location @forums {
rewrite ^/forums(.+)$ /forums/index.php?p=$1 last;
}问题是我安装了香草论坛的sitemap插件。
由此产生的站点地图应该位于
example.com/forums/sitemapindex.xml
但是当我在那里导航时,nginx给了我404。
我该怎么解决这个问题?
发布于 2016-10-07 22:36:04
问题是URI /forums/sitemapindex.xml正在由location ~* ^.+.(jpg|jpeg|gif|css|png|js|ico|xml)$块处理,而不是转发给/forums/index.php。
如果不提供静态.xml文件,则可以简单地从正则表达式中删除|xml术语。
否则,您将需要使该URI成为一个特例,例如:
location = /forums/sitemapindex.xml {
rewrite ^ /forums/index.php?p=/sitemapindex.xml last;
}https://stackoverflow.com/questions/39926014
复制相似问题