Redirect a Main Domain in cPanel to it’s Parked Domain

Posted: March 21, 2014 in cPanel

I have a main domain, ‘redirect-from.com’ with user name ‘redirect’ in my cpanel and I have craeted a parked domain ‘redirect-to.com’ in this account. As you know both are loading the same pages here.

I need to redirect the url, http://redirect-from.com/ to http://redirect-to.com/ , for that I have select the option, ‘Redirect’ from the cPanel and I have encountered an error like the following when adding the redirect. I have this problem only when creating a redirect via cPanel when creating redirect rule from the main domain to a parked domain in the same account.

Error Adding Redirection

Redirecting “” to “http://redirect-to.com/” will cause a redirection loop because “http://redirect-from.com/”, which is located at “/home/redirect/public_html/”, is above “http://redirect-to.com/”, which is located at “/home/redirect/public_html/” .

Create a rule in .htaccess as follows to redirect the main domain to it’s parked domain.

# cat /home/redirect/public_html/.htaccess

###########################

RewriteEngine On

RewriteCond %{HTTP_HOST} ^redirect-from.com$ [NC]
RewriteRule ^(.*) http://redirect-to.com/$1 [R=301,L]

##########################

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s