Skip to contentSkip to main navigation Skip to footer

How to Set up sitemap.xml on Apache Servers?

Squirrly SEO automatically generates your sitemap when you enable the XML Sitemap settings.

On some Apache servers, based on the server configuration, you may need to add server-level rewrites to correctly set up the sitemap.xml file.

For this purpose, we recommend setting the following rules for Squirrly SEO sitemap in .htaccess file:

<IfModule mod_rewrite.c>
    RewriteEngine On

    RewriteRule ^sitemap.xml$ /index.php?sq_feed=sitemap [L]
    RewriteRule ^sitemap-posts.xml$ /index.php?sq_feed=sitemap-post [L]
    RewriteRule ^sitemap-posts.xml\?page=([0-9]+)$ /index.php?sq_feed=sitemap-post&page=$1 [L]
    RewriteRule ^sitemap-pages.xml$ /index.php?sq_feed=sitemap-page [L]
    RewriteRule ^sitemap-pages.xml\?page=([0-9]+)$ /index.php?sq_feed=sitemap-page&page=$1 [L]
    RewriteRule ^sitemap-categories.xml$ /index.php?sq_feed=sitemap-category [L]
    RewriteRule ^sitemap-tags.xml$ /index.php?sq_feed=sitemap-tag [L]
    RewriteRule ^sitemap-archives.xml$ /index.php?sq_feed=sitemap-archive [L]
    RewriteRule ^sitemap-archives.xml\?type=([a-z]+)$ /index.php?sq_feed=sitemap-archive&type=$1 [L]
    RewriteRule ^sitemap-custom-taxonomies.xml$ /index.php?sq_feed=sitemap-custom-tax [L]
    RewriteRule ^sitemap-custom-taxonomies.xml\?page=([0-9]+)$ /index.php?sq_feed=sitemap-custom-post&page=$1 [L]
    RewriteRule ^sitemap-custom-taxonomies.xml\?page=([0-9]+)&type=([a-z]+)$ /index.php?sq_feed=sitemap-custom-post&page=$1&type=$2 [L]
    RewriteRule ^sitemap-custom-posts.xml$ /index.php?sq_feed=sitemap-custom-post [L]
    RewriteRule ^sitemap-custom-posts.xml\?page=([0-9]+)$ /index.php?sq_feed=sitemap-custom-post&page=$1 [L]
    RewriteRule ^sitemap-custom-posts.xml\?page=([0-9]+)&type=([a-z]+)$ /index.php?sq_feed=sitemap-custom-post&page=$1&type=$2 [L]
    RewriteRule ^sitemap-([a-z]+).xml$ /index.php?sq_feed=sitemap-$1 [L]
</IfModule>

NOTE! In case you are not 100% sure where to add these rules, we recommend reaching out to your web host or server admin and asking for further assistance.

Still Need Help?

If you’ve added the rewrite rules in the correct file, and you still encounter issues, they are likely linked to other settings on your server. You can always reach out to our support team via one of the available channels whenever you need more assistance.

Before you leave

Learn how AI search is changing visibility

A free course from the AISQ Growth team, built from real experiments, not theory.

ChatGPT traffic proven

Worksheets & templates included

No paywall

Free now, free forever

No credit card. No paywall. Lifetime access.

It’s time to stop orbiting SaaS.

Be the Meteor.

10 Elite Tools. 1 Stack.