Created
April 9, 2013 13:57
-
-
Save jdevalk/5345872 to your computer and use it in GitHub Desktop.
Fix XML sitemaps to work by forcing .htaccess to pick them up. Add this to the .htaccess, above the WordPress rewrites. This version assumes you're using a subfolder install with WordPress installed in /wordpress/, adapt if needed.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# WordPress SEO - XML Sitemap Rewrite Fix | |
RewriteEngine On | |
RewriteBase /wordpress/ | |
RewriteRule ^sitemap_index.xml$ /wordpress/index.php?sitemap=1 [L] | |
RewriteRule ^([^/]+?)-sitemap([0-9]+)?.xml$ /wordpress/index.php?sitemap=$1&sitemap_n=$2 [L] | |
# END WordPress SEO - XML Sitemap Rewrite Fix |
I also have an install of nginx that forces closing /
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /blog/
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
# WordPress SEO - XML Sitemap Rewrite Fix
RewriteRule ^sitemap_index.xml$ /wordpress/index.php?sitemap=1 [L]
RewriteRule ^([^/]+?)-sitemap([0-9]+)?.xml$ /wordpress/index.php?sitemap=$1&sitemap_n=$2 [L]
# END WordPress SEO - XML Sitemap Rewrite Fix
</IfModule>
http://nblog.airbrake.io.php53-5.ord1-1.websitetestlink.com/wp-admin/admin.php?page=wpseo_xml
http://airbrake.io/blog/sitemap_index.xml/
Yep, seems to work fine. Thanks for that!
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
whats the nginx alternative for this.
your plugin generates
rewrite ^/sitemap_index.xml$ /index.php?sitemap=1 last;
rewrite ^/([^/]+?)-sitemap([0-9]+)?.xml$ /index.php?sitemap=$1&sitemap_n=$2 last;
but that doesnt work, i get 404s. my sub directory is domain.com/blog/