How can I disable access to add on domain through main domain?

Asked by:
McSilvio / 13 Points
Time:
2012-03-05 2:56 am EST
Category:
Domain Names
Hits:
1,944
Hi there,
I have a main domain (myspidersenseistingling.com) and ive just got an add-on domain to work (professionaldu.com). It is working well and when I go to professionaldu.com I get the correct content. However, I can access professionaldu.com in several ways that I do not like.

(professionaldu.myspidersenseistingling.com)
(myspidersenseistingling.com/professional.com)

My preference is to ONLY access professionaldu.com by going to that url directly (professionaldu.com). How can this be achieved?

Thank you,
Marco.

To ask this user for more information, please first login.

To submit an answer, please login.

Best answer chosen by Web Hosting Hub staff

0

ChristiNi
Staff
13,688 Points
2012-03-05 6:27 pm EST
Hello Marco,

Great question about working with Addon domains. Normally, most people visiting your site will not try the different URLs for an Addon domain, but we can understand why may not want to allow these different methods of accessing the site. Fortunately, this can be controlled within your Addon domain's .htaccess file

To send all traffic through the www URL for your Addon domain, the code will follow this format:

RewriteEngine On
RewriteCond %{HTTP_HOST} !^www.addondomain\.com [NC]
RewriteRule ^(.*)$ http://www.addondomain.com/$1 [R=301,L]

In your case, it would be:

RewriteEngine On
RewriteCond %{HTTP_HOST} !^www.professionaldu.com\.com [NC]
RewriteRule ^(.*)$ http://www.professionaldu.com.com/$1 [R=301,L]

To send all traffic through the non-www version of your Addon domain's URL, the code will follow this format:

RewriteEngine On
RewriteCond %{HTTP_HOST} !^addondomain\.com [NC]
RewriteRule ^(.*)$ http://addondomain.com/$1 [R=301,L]

In your case, it would be:

RewriteEngine On
RewriteCond %{HTTP_HOST} !^professionaldu\.com [NC]
RewriteRule ^(.*)$ http://professionaldu.com/$1 [R=301,L]

Please let us know if you have any additional questions or need further assistance.

Regards,

Christi N.

To submit a comment on this answer, please first login.

Want to share this Question?

Related Articles

It looks like there are no related articles.
Would you like to ask a question about this page? If so, click the button below!
Need More Help?

Help Center Search

Current Customers

Email: support@WebHostingHub.com Ticket: Submit a Support Ticket
Call: 877-595-4HUB (4482)
757-416-6627 (Intl.)
Chat: Click To Chat Now

Ask the Community

Get help with your questions from our community of like-minded hosting users and Web Hosting Hub Staff.

Not a Customer?

Get web hosting from a company that is here to help.
}