Add Custom Rules to Wordpress .htaccess
Wordpress uses a .htaccess file to rewrite all the URLs to look like “http://www.kingrosales.com/category/internet-marketing/” rather than “http://www.kingrosales.com/index.php?pageid=10″.
By default, a Wordpress .htaccess file looks like:
# BEGIN wordpress
<ifmodule mod_rewrite.c>
rewriteEngine On
rewriteBase /
rewriteCond %{REQUEST_FILENAME}!-f
rewriteCond %{REQUEST_FILENAME}!-d
rewriteRule . /index.php [L]
</ifmodule>
# END wordpress
When I had to install a custom application under a non-wordpress directory and wanted to rewrite those URLs, I would always get a “Error 404 – Page Not Found” from Wordpress & any custom non-wordpress related rules I was writing wouldn’t work.
Solution:
If you want to add custom .htaccess non wordpress rules, simply enclose your custom rules between a new “<ifmodule mod_rewrite.c>…</ifmodule> and have it positioned above the exisiting Wordpress rules:
# My Custom Rules
<ifmodule mod_rewrite.c>
rewriteEngine On
... Your Custom Rules Here...
</ifmodule>
# End Custom Rules
# BEGIN wordpress
<ifmodule mod_rewrite.c>
rewriteEngine On
rewriteBase /
rewriteCond %{REQUEST_FILENAME}!-f
rewriteCond %{REQUEST_FILENAME}!-d
rewriteRule . /index.php [L]
</ifmodule>
# END wordpress
And that’s it! Happy Rewriting
Popularity: 4% [?]
Related posts:
- How to Secure Wordpress
- How to Display Your Post’s First Image Thumbnail Automatically in Wordpress
- How To Optimize (SEO) Wordpress Tag Pages Title Tags
- Use get_the_post_thumbnail to Set Your Post’s Thumbnail in Wordpress 2.9+
- Twitter Wordpress Plugin, Twitter API

Could you please give me an example custom htaccess code for adding non wp directory?
I’ve tried but still have 404 error
This does not work – 404 page is always returned
def. didnt’ work.
Like the others, this also DIDN’T work for me.
Leave your response!
Recent Posts
Internet Marketing Jobs
Categories
Links
Blogroll
Archives
About Me
I am an Internet Marketer. I specialize in SEO, Social Media and Wordpress. On my free time, I work on my blog network which I use to make money online with adsense, banner ads and affiliate marketing.
Connect With Me:
Most Commented