| By: Brennan Heyde | Published On: 11/07/2007 |
An .htaccess file is a very power server configuration file used in Apache web servers. Unless you are on a Windows hosted server, most likely your web server is running Apache and capable of using an .htaccess file.
An .htaccess file is a simple text file. .htaccess is not a file extension, but rather the actual name of the file. Your .htaccess file can be found in the root directory of your server. If you do not see one, then most likely you do not have one yet.
To create an .htaccess file open up your HTML editing software such as Dreamweaver and save a blank file named “.htaccess” (make sure to include the “dot” in front)
Every Miva store owner should be using an .htaccess file on their website. Here are 5 helpful tips when using an .htaccess file with Miva Merchant.
- Home Page Redirect – Miva’s default homepage is located at www.yoursite.com/mm5/merchant.mvc or www.yoursite.com /Merchant2/merchant.mvc depending on if you are using Miva 4 or Miva 5. We want our visitors to just type in www.yoursite.com, and not have to remember the /mm5/merchant.mvc part. An easy way to do this it to use the DirectoryIndex feature of your .htaccess file. It looks like this:
DirectoryIndex /mm5/merchant.mvc
This tells your web server to load this page first when someone visits your site.
Another benefit of using the directory index is that your URL will look like www.yoursite.com rather than www.yoursite.com/mm5/merchant.mvc. The /mm5/merchant.mve gets removed from the URL.
2. Force the “www” – Search engines will treat http://www.yoursite.com different than http://yoursite.com even though they are the same site. You always want to force the www. This can be done easily with the following code in your .htaccess file.
RewriteEngine On
# redirect to preferred www domain
RewriteCond %{HTTP_HOST} ^yoursite\.com
RewriteRule (.*) http://www.yoursite.com/$1 [R=301,L]
Make sure you change the “yoursite” to your actual domain name.
- Error Pages – You definitely want to have a 404 error page for your Miva site. This is a “page not found” error, and it is very common. Your 404 error page can be a static html page or even a customized Miva page. This redirect can be done in one simple line:
ErrorDocument 404 /error-page.html
Now when someone misspells a URL, or tries to visit your site at a page that is no longer there, they will be redirected to your custom error page. On your error page make sure you tell your visitors that the page they are looking for cannot be found and also provide them with a navigation menu to browse other pages of your site.
4. 301 Redirects – 301 Redirect allow you to safely rename a page or move it all together. Say for example your redo your website and all your page names change. However you don’t want to loose any of your search engine traffic you are getting from your old indexed pages. What do you do?
The best and simplest solution is to implement a 301 Redirect. This tells Google and the other search engines that your old page has moved to a new page. Here is the code:
Redirect 301 /old_page.html http://www.yoursite.com/new_page.html
Your new page will keep the same the search engine rankings as the old page. Now when someone tries to visit you old page, they will automatically be redirected to your new page.
- Search Friendly Links – Search Engine Optimization is becoming more and more important to drive traffic to your website. It is essential that you have your Miva site optimized for the search engines, because you can be assured that your competitors are doing it. In order to create search friendly links you need the Ultimate SEO Links
module from Sebenza. This module creates clean and simple URLS for your website that the search engines love to index. In order to achieve this you need to add a few lines of code to your .htaccess file.
You can learn more about SEO for Miva Merchant here.
Your .htaccess file has wide array of uses. However take caution when working with your .htaccess file. One typo or wrong character can take your entire site down. Always create a backup of your file before you start editing it. This way if something goes wrong, you can easily revert back.
About the Author: Brennan Heyde is an e-commerce consultant working in San Diego, Ca. He specializes in online marketing and SEO for e-commerce. Have a struggling e-commerce website? – Contact Brennan today for a site analysis.
















