Cpanel addon domains and redirections

If anyone had a problems with cpanel addon domains and redirections (basically redirections defined by cpanel for addon domain are not working and we have several URL under the site is available instead of single one) you need to add following section to your .htaccess file:

  RewriteCond %{HTTP_HOST} !^(www.)?sevencoins.pl$ [NC]
  RewriteCond %{HTTP_HOST} !^$ [NC]
  RewriteRule ^(.*)$ http://sevencoins.pl/$1 [R=301,NC,L] 

Replace sevencoins.pl with your site name. Basically the rule forces the URL for given web subdirectory to be set to defined one (as addon domains use subdirectories) .

Based on description found on:

http://www.techofweb.com/tips-n-tricks/redirect-addon-domain-htaccess.html

%d bloggers like this: