301 Redirect

From OCS Support Wiki

Jump to: navigation, search

[edit] Introduction

This guide will show you how to implement a 301 redirect. 301's are desired instead of domain aliasing for search engine reasons.

[edit] Prerequisites

  • The domain name must be pointing to our name servers, and you've told us to add it to our DNS system
  • You must have the domain added to the parked domains section in cPanel or in Webmin

[edit] Creating the Redirect

To create the redirect, edit or create a file called .htaccess in your public_html folder and add this to it:

RewriteEngine On
RewriteCond %{HTTP_HOST} ^parked-domain.com [OR]
RewriteCond %{HTTP_HOST} ^www.parked-domain.com
RewriteRule ^(.*)$ http://www.main-domain.com/$1 [L,R=301,NC]

Replace parked-domain.com with the domain to redirect, and main-domain.com with your primary domain. Once you save the file, this will activate the redirect.