humblearab
Forum Replies Created
Viewing 1 replies (of 1 total)
-
Forum: Plugins
In reply to: [XML Sitemap Generator for Google] Nginx: “rewrite” is not terminated by “;”Just came across this after copying the rewrite rules from the plugin.
If replacing{1,4}with+fixes the problem, it suggests that the{1,4}quantifier might be interpreted incorrectly by Nginx. To use{1,4}correctly, you should escape the curly braces with backslashes:
However, using+as a replacement for{1,4}works if you only need to match one or more digits instead of a specific range. The+quantifier matches one or more of the preceding elements, which simplifies the regular expression.
Regex headache again 😅
The correct rules, that would work by default would berewrite ^/.*-misc?\.xml$ "/index.php?xml_sitemap=params=$2" last; rewrite ^/.*-misc?\.xml\.gz$ "/index.php?xml_sitemap=params=$2;zip=true" last; rewrite ^/.*-misc?\.html$ "/index.php?xml_sitemap=params=$2;html=true" last; rewrite ^/.*-misc?\.html\.gz$ "/index.php?xml_sitemap=params=$2;html=true;zip=true" last; rewrite ^/.*sitemap.*(?:\d\{1,4\}(?!-misc)|-misc)?\.xml$ "/index.php?xml_sitemap=params=$2" last; rewrite ^/.*sitemap.*(?:\d\{1,4\}(?!-misc)|-misc)?\.xml\.gz$ "/index.php?xml_sitemap=params=$2;zip=true" last; rewrite ^/.*sitemap.*(?:\d\{1,4\}(?!-misc)|-misc)?\.html$ "/index.php?xml_sitemap=params=$2;html=true" last; rewrite ^/.*sitemap.*(?:\d\{1,4\}(?!-misc)|-misc)?\.html\.gz$ "/index.php?xml_sitemap=params=$2;html=true;zip=true" last;I think the
{1,4}is meant to capture part of the sitemap where it might be something likeproduct-sitemap1234.xml
Viewing 1 replies (of 1 total)