block by roachhd 7bce1f66abfc865f9aab

.htaccess file tips tricks and easy stuff I didn't know.

Pointing your home site’s URL to a subdirectory In some cases, you may have a WordPress site that changes significantly every year, such as with a conference website. If you want to install each year’s version of the site in a subdirectory, such as /2010, /2011, and /2012, but have the root domain (yoursite.com) automatically redirect to a particular subdirectory (usually the latest), follow this technique:

Install WordPress in a subdirectory, such as /2012. In your root folder (not the subdirectory folder), download and open your .htaccess file.

Add the following to your .htaccess file:

RewriteEngine On
RewriteCond %{HTTP_HOST} ^(www.)?YourDomain.com$
RewriteRule ^(/)?$ blog [L]

In the above code, change the “YourDomain.com” value to your root domain. In the above code, change the “blog” value to the subdirectory. Save and upload the .htacess file back to your root directory. Now when users to go your root domain (yoursite.com), it will automatically redirect to the subdirectory you specified. When you want to redirect to a new subdirectory, such as the conference site for next year, just update the .htaccess redirect code.

Note: This code comes from Site 5’s post here: How to Redirect Your Domain to a Subfolder Using .htaccess.