Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
WordPress htaccess
RewriteRule ^rss.xml$ /index.php?feed=rss2&cat=-847 [L,R]
RewriteRule ^snippets.xml$ /index.php?feed=rss2&cat=847 [L,R]
RewriteRule ^feed/$ /rss.xml [L,R]
RewriteRule ^category/(.*)\.html$ /category/$1/ [L,R]
@svandragt

This comment has been minimized.

Copy link

svandragt commented Jun 25, 2015

  • change 847 with the category ID that you status posts get assigned to
  • Your code caused a redirect loop for me, the following code did what I wanted (I included a bit more context)
  • The rules depend on the permalink structure (mine currently is: /%year%/%monthnum%/%postname%)
  • It seems to work best when the rules are places before the BEGIN/END Wordpress comment blocks as these are replaced when the permalinks structure changes, as below:
# BEGIN snippets
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /

RewriteRule ^rss\.xml$ "/feed?cat=-847"[L,R]
RewriteRule ^snippets\.xml$ "/feed?cat=847"[L,R]
RewriteCond %{Query_STRING} ^$
RewriteRule ^feed$ "/rss.xml" [L,R]
</IfModule>
# END snippets

# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>
# END WordPress
@manton

This comment has been minimized.

Copy link
Owner Author

manton commented Jun 25, 2015

@svandragt Thanks for including your notes and a more complete example!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.
You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session.