首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >Vanilla无法访问的香草论坛sitemapindex.xml文件

Vanilla无法访问的香草论坛sitemapindex.xml文件
EN

Stack Overflow用户
提问于 2016-10-07 21:24:43
回答 1查看 57关注 0票数 1

我的论坛安装在网址:example.com/论坛上。

我用过nginx和Vanilla来“美化”urls。我设置了

/forum/conf/config.php, “RewriteUrls” to “True”.

在我的nginx.conf中:

代码语言:javascript
复制
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。

我该怎么解决这个问题?

EN

回答 1

Stack Overflow用户

回答已采纳

发布于 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成为一个特例,例如:

代码语言:javascript
复制
location = /forums/sitemapindex.xml {
    rewrite ^ /forums/index.php?p=/sitemapindex.xml last;
}
票数 1
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/39926014

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档