.htaccess File for SEO

Basic SEO|Shopper Experience - Last updated Nov 2, 2016

An .htaccess file is a directory-level file that can be used to manage some web server configurations. This means that using this file, you can tell web servers how to act with regards to some elements of your website. .htaccess files were originally used to password protect directories, but now have added uses including browser cache settings, custom error messages and redirects. These files can even be used to help with SEO and usability for your website.

How To Access your .htaccess file?

In order to modify your .htaccess file, you will need to log into your website through the server, using an FTP client (File Transfer Protocol). Two common FTP clients are FileZilla and Transmit (for Mac); images shown below are using these two clients. Once you have downloaded and installed an FTP client to your computer, you can open that FTP client, and enter your domain login information. Many hosting providers will setup FTP login with your web hosting account login or even your ShopSite login account information initially, but often the logins get changed by merchants so the logins will not always match. If you do not have the login information to access your domain through FTP, you will need to contact your hosting provider and they can reset (or setup) FTP login for you.

  1. Log Into Your Domain Through FTP. Open your FTP client and enter your domain name and login information.
  2. FTP Login for .htaccess editing
  3. Show Hidden Files. The .htaccess file is sometimes a hidden file so you may need to choose to display it.
  4. FTP Transmit Show Invisible Files
  5. Edit in Notepad or TextEdit. Now in your FTP client you should be able to right click (or two finger click for Mac users) and open your .htaccess file in Notepad or TextEdit (Mac).

Note: If you are not able to edit your file and get a message about needing to unlock the file or you don't have permission. Try right clicking the file and "get info" or "file permissions" and change the permissions to 777, then try editing the file.


.htaccess Redirects

Whenever you are moving a page, deleting a page, or in any way changing the path to a page you will want to setup a redirect to the new page from the old page. This is good for search engines so that your page doesn't lose its search engine ranking. This is good for visitors so that they don't click on a link and come to a 404 page not found error message. This is also good for your associates and other websites who link to your pages so that they don't have to update their links.

Setting up an .htaccess file redirect is fairly simple, but since you are working with server files, you want to be extra careful that you aren't making any mistakes.

  1. On a new line in your .htaccess file, add the following example code but replace the /old-file-name.html with the file name of your current page and replace http://www.domain.com/new-file-name.html with the full URL to your new page.
    Redirect permanent /old-file-name.html http://www.domain.com/new-file-name.html
     
  2. Save changes and test your new link. In a browser window, type in the URL to the old page and see if you are given the new page. If you are not getting the desired result, you may need to contact your hosting provider to help you troubleshoot what the issue might be.