301 and 302 Redirects (e.g. SEO Optimization) Print

  • 0


Here are the steps for making a 301 or 302 redirect users from one resource to another on your website. It is often used for Search Engine Optimization Reasons. You do this by creating an .HTACCESS file in the root of your website. At EPhost we support the use of .HTACCESS on both Windows and Linux hosting plans. On Windows, you may also use the native Web.config file for 301 and 302 redirects using Microsoft's IIS syntax. Please note, the shorthand version of 301 redirect rules (redirect 301 old.html new.html) will NOT work and you will need to use the more detailed long form below.

WARNING: It is COMPLETELY possible to accidentally block all visitors to your website or get banned from a search engine. Again, we do not suggest using this tag without having conducted ample research. If you are unable to follow the directions below, it is likely you do not have the expertise to implement this tag. 

Here are the steps (Windows and Linux Plans):

  1. Create a text file called .HTACCESS and upload it into your website's root directory. e.g. wwwroot or public_HTML
  2. Add the following to the top of the file:  
    RewriteEngine On
    RewriteBase /
  3. Follow some of the options below to write a rule to make your redirect.

Here are samples of the two most likely rules you will need:

  1. The first redirects visitors who do not type in WWW when requesting your domain name e.g. http://ephost.com to the same domain but WITH the WWW in front. e.g. http://www.ephost.com.
    RewriteCond %{HTTP_HOST} !^www\.yoursite\.com
    RewriteRule (.*) http://www.yoursite.com/$1 [R=301,L]\
  2. The second rule is the opposite of the one above and forces WWW to your apex domain (no www).
    RewriteCond %{HTTP_HOST} ^www\.yoursite\.com [NC]
    RewriteRule (.*) http://yoursite.com/$1 [R=301,L]
  3. This redirects visitors looking for a specific web page to another web page.

    RewriteCond %{HTTP_HOST} ^www\.yoursite\.com [NC]
    RewriteRule ^images/your-old-logo-\.gif$ http://yoursite.com/images/your-new-logo.png$1 [R=301,L]

 Best of luck with your SEO endeavors.


Also See: Website Features KB's Domain/DNS KB'sHOW TO KB'sEmail Settings POP3 / IMAP | Check email online | Email Troubleshooting | Adding an email to your hosting account WINDOWS / LINUX

Contact Support

If you are still having issues, please contact us for further help.
1-877-EPHOST1 | support@ephost.com



Was this answer helpful?

« Back