February 16th, 2008

Controlling non-WordPress Subfolder Access with .htaccess

by John Kolbert as Tutorial/How-To | Tags:

WordPress users commonly use the built-in permalink redirection. This means that rather then having your new blog article’s URL look like “http://myblog.com/?p=78″, you make it look like this: “http://myblog.com/articles/my-article-title.” This feature means WordPress interprets the URL query of your blog and outputs the corresponding article.

This is great for readability and SEO, but what if you want to add a non-WordPress subfolder to your website with, say, a forum in it? If you make your forum address “http://myblog.com/forum/”, WordPress will try to interpret this URL. Not being able to find anything, you will get your blog’s 404 error page. Luckily, fixing this is easy.

If you are running on an Apache server, using a simple .htaccess file is all you need. If you aren’t too familiar with .htaccess, don’t worry about it. This is what you need to do:

First, create a file called htaccess.txt on your computer. In it, paste the following code:

# disable the rewrite engine
RewriteEngine off

This will tell your web server to disable the URL rewrite engine for the specified folder.

Second, upload this txt file to the subfolder on your domain that you don’t want WordPress to interpret. Finally, rename the file that you just uploaded to .htaccess, minus the quotes. Don’t forget the initial period.

And that’s all there is too it! Now you can have subfolders on your site without conflicting with the WordPress permalink structure.

4 Responses to “Controlling non-WordPress Subfolder Access with .htaccess”

  1. peterdan says:

    I don’t have a server now, should I use htp://tinyurl.com or http://xiy.net to redirect my site? Thanks.

  2. John Kolbert says:

    @peterdan I’m afraid I’m not real sure what you mean. Feel free to leave more details or to use my contact form and I’d be happy to help you.

  3. Cristian says:

    Thank you so much, you saved my life!!

    I knew it was something related to the .htaccess file, but didn’t know what it was exactly.

    Thanks!

Leave a Reply