1

My forum is installed on the url: example.com/forums

I have used nginx and Vanilla to "prettify" the urls. I've set

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

and in my 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;
}

The problem is I installed the sitemap plugin by Vanilla Forums.

and the resulting sitemap is supposed to be located at

example.com/forums/sitemapindex.xml

But when I navigate there nginx gives me a 404.

How do I solve this?

Jay Boy
  • 161
  • 1
  • 8

1 Answers1

1

The problem is that the URI /forums/sitemapindex.xml is being processed by the location ~* ^.+.(jpg|jpeg|gif|css|png|js|ico|xml)$ block and not being forwarded to /forums/index.php.

If you do not serve static .xml files, you could simply remove the |xml term from the regular expression.

Otherwise, you will need to make that URI a special case, for example:

location = /forums/sitemapindex.xml {
    rewrite ^ /forums/index.php?p=/sitemapindex.xml last;
}
Richard Smith
  • 45,711
  • 6
  • 82
  • 81