The Movable Type Knowledge Base

Use htaccess To Make Weblog Appear At Root

Question

I'm unable to publish my weblog index to the root folder of my site due to host restrictions, so I have it publishing to a subfolder. But I still want it to be the first page visitors see when they browse to my domain name.

Answer

If your account is hosted on an Apache server, see if your host permits you to use .htaccess files.

An .htaccess file is a hidden system file in your server directories. You may or may not have one by default, depending on your host. The file can be created in any text editor and uploaded to the directory you keep your publicly accessible files in. The files are read in a hierarchial order, meaning all subdirectory .htaccess files follow the rules set by the parent directory .htaccess file.

The files handles multiple configuration options and behaviors for an Apache server, including Directory redirecting, Hotlink Protection, Spam filtering, and IP Deny/Allow. It's a very powerful tool for webmasters.

Be very careful with these files. If you are not confident with making changes to your .htaccess file, do not upload them to your server. You could potentially lock yourself out of your site as well as any visitors.

Changes to your .htaccess file can be used when you publish your weblog files into a subdirectory but want the Main Index Template (index.html) file to appear as though it's in the root directory. If your blog file is at http://www.example.com/blog/ and you'd like visitors to be able to type http://www.example.com/ to get to your site, put this in your .htaccess file:

DirectoryIndex ./blog/index.html

For more information: http://apache-server.com/tutorials/ATusing-htaccess.html

Submit Feedback on This Article

Your comments on how we can improve this article are appreciated; but please do not use the feedback form to submit support requests or questions. We will not respond to or publish such queries submitted through this form. If you have a technical question or problem, visit Movable Type Support.

Yahoo! Small Business web hosting services

Six Apart
Makers of weblog software and services for individuals, organizations and businesses.
This website is powered by Movable Type.