If you are thinking for one second the rules are stored in .htaccess in the wordpress folder, you are totally wrong. Infact these rules are stored in mysql database in the wp_options table under rewrite_rules field.

Checkout this site for complete list of wordpress 2.x rewrite rules
Although it is common for most php related applications save all the rules in htaccess files, it is not the case with wordpress.
which is why you will see only the default rules when you open .htaccess file. All the permalinks and rewrite rules are stored in database.
RewriteEngine On
RewriteBase /
RewriteRule ^go/([0-9]+)/$ /index.php?go=$1
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
If you are a wordpress plugin developer and often you might want to add custom rewrite rules for your plugin. For that there is a separate WP_Rewrite class
For more wordpress documentation on rewrite rules, be sure to checkout WordPress custom queries and Query overview.
You can decode and see the rewrite rules using the Rewrite rules viewer plugin. You might need this while developing your custom rewrite rules.
Similar Posts:
- Affiliate Hide v1.0 – Free WordPress plugin to Hide & Redirect Affiliate Links
- Problem with Custom rewrite rule in WordPress
- Disable Permalinks in WordPress folders
- How to manually upgrade wordpress from older versions
- 10+ Best Tutorials for WordPress Plugin Writing & Development
- Best Tutorial Videos for WordPress Plugin Writing
- Fixing WordPress custom permalinks 404 error
- Affiliate Hide – Free wordpress plugin to redirect affiliate links!
- Tutorial: How to write a WordPress Plugin?
- Retrieve select box value from database using PHP


May 8, 2010
nice…thank
May 11, 2010
Cheers for this info – I managed to hose a WP installation today by screwing with the rewrite class, so this is handy to know haha.
December 12, 2010
hi,
I have a question about wordpress rewrite rules that maybe you can help me with. I would like to post it in the wordpress forums but I registered and I can’t log in. it just keeps telling me that my password is wrong. Even registered a 2nd time and still no joy. Oh well…
I have wordpress installed in the root and I’m trying to incorporate some custom rewrite rules. they look like this:
RewriteRule ^blog[/]?$ index.php
RewriteRule ^writing[/]?$ writing.php
RewriteRule ^art[/]?$ art.php
RewriteRule ^music[/]?$ music.php
RewriteRule ^design[/]?$ design.php
RewriteRule ^animation[/]?$ animation.php
RewriteRule ^video[/]?$ video.php
RewriteRule ^contact[/]?$ contact.php
pretty straight forward stuff. my permalink structure is “/blog/%postname%/” so basically I want website.com/blog to direct to the wordpress home page but instead I get a 404. My other pages seem to work but I get a “page not found” in the page title which is strange.
Is what I’m trying to do possible?
I would imagine that I could achieve it by adding to the WP rewrite rules using the WP_rewrite class? I’m not really sure where I would put the code though.
I did try tinkering with it but got stuck. I was contemplating just “hard coding” the rules by adding them straight into the field in the DB which is how I stumbled on this page. Not ideal to say the least I know but desperate times call for desperate measures.
Any help with this would be much appreciated!!
December 13, 2010
Try this and i suspect that you havent used rewrite base which is why you are getting 404 error.
RewriteEngine On
RewriteBase /
RewriteRule ^blog[/]?$ index.php
February 4, 2011
Thanks for your informative post. Someone on a webmaster board suggested that I look at how WordPress handled rewriting as a guide for my own needs. The htaccess file in the WordPress folder did not seem to do much. It turns out it’s all in the database and quite complex to say the least. I copied WordPress’ rewrite rules from the database, serialized it, then did a print_r to dump it to the browser. Doesn’t look like a whole lot I can use.
March 21, 2011
seems like you are using wpress as a cms here-you know you can modify your permalinks for pages within wordpress. i.e. page slug etc.
September 30, 2011
Hi,
How can i export rewrite rules from wordpress to .htaccess form?
Thanks,
Hassan.