Category Archives: addon-domain

Preventing primary domain from showing addon domains’ content as its subfolder

I have a primary domain and 5 addons as independent sites. Everything is fine, but when one clicks, s/he can access irrelevant content over primary website. I want to prevent this.

I am looking for a solution via the htaccess in root of primary, not to edit 5 htaccess files of addons.

Simply, I tried the below code in primary htaccess, but it doesn't work. I tried many other alternatives, but doesn't work. Why? What is wrong with this?

<IfModule mod_rewrite.c>
RewriteEngine On
RewriteCond %{HTTP_HOST} (.*)primary\.com$
RewriteRule ^/(addon1|addon2|addon3|addon4|addon5)(.*)$ [R=301,L]

Redirect Exclusions [on hold]

I have and under that I have a subdomain set up as I also have an addon domain set up as I want (with and without www) to redirect to Then and (with or without www) both need to run their respective Wordpress sites already loaded onto them. Also, if possible, should also redirect to (This is for all the google search results I might still have to certain pages). I've probably been through every tutorial on the web, but nothing gives me this specific result I'm looking for. Any help would be greatly appreciated. Even if I can only get to work and to redirect (with and without www).

Thank you for your time.

Add-On Domain Redirects to HTTPS

I have a GoDaddy shared hosting account with one main domain that uses SSL and now an add-on domain that I do not want to use SSL. I would like to redirect non-https to https for the main domain BUT NOT for the add-on domain. Both sites use Wordpress.

To be clear, the main domain should use https, the add-on domain should not use https.

The problem I am experiencing is is redirecting to

I know the problem can be fixed through my .htaccess file, and I have made several attempts, but each one ends with the add-on domain redirecting back to the main domain. Any insight as to what I need to change on my .htaccess file would be very much appreciated!

Here is what my .htaccess file looks like:

# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteCond %{HTTPS} off
RewriteRule ^(.*)$ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
# END WordPress

Add On Domain IP Address

Do add on domains need a unique ip address or can they point to the same ip address as the main domain and use the .htaccess file to redirect to the subfolder?


I am trying to host two web applications on a single server. I setup the new domain name as an add on domain to my current server. In the process of getting it to work I replaced the new domain A record ip address with the current domain name ip address on the server thinking that it had to point to the same place.

Now when I type out the full it just points to the same files as the other web application and if I type only it gives me a warning and fatal error about failing to open a required file css_version.php.

I managed to get to redirect to the proper add on subfolder using the .htaccess file but still points to the other web application.

Can I fix this with the .htaccess file or does the domain name need to have a unique ip address for the server to differentiate between the two domains and if so how can I get the unique ip address it had back?

Redirect all requests to index.php except subdomains

I'm using AltoRouter: ( and I modified .htaccess as suggested in the instalation to:

RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule . index.php [L]

This is so that index.php can handle all the requests. My problem is that I am using addon domains in cpanel and I am having internal server errors when I try to access one of the domains associated with the addon domain.

Example: My main domain is

Then I have several sites: that cpanel automatically associates with and creates a folder So if I access I would see in browser but the content delivered would be the one inside the folder.

This works if I don't use the .htaccess rule but I need it for routing. If I have that rule I get internal server errors everytime I access (I assume that it's a conflict between cpanel rules and .htaccess).

How can I modify the rule so that it only affects maindomain and not subdomains? I am assuming that by doing this there would be no conflict and my problem would be solved.

I am really bad at .htaccess and regex but I am willing to learn if needed. I would still appreciate if you could point me to the right direction. (both in the idea and in good websites that can help me understanding this)

add-on domain path without main domain path in URL

In my hosting account on cpanel, I have one main domain for e.g. and one addon domain say The document root of addon domain is home/public_html/ So the .htaccess file in root directory of is the main htaccess file. (no another .htaccess file for addon domain). The problem is is automatically redirected to I have set 301 redirection only for (for non-www to www). I want when I type it is redirect as not as

.htaccess redirect http to https for only some addon domains

I have a multiple addon domains on my hosting account. I would like to redirect non-https to https for the main domain AND ONLY ONE of the addon domains.

The problem I am experiencing is is not redirecting to Instead it does not appear to be redirecting at all. It stays at

Note: I do not want to redirect all http to https. I have another addon domain that I do not want redirected to https.

Here is what my .htaccess file looks like:

RewriteEngine On
RewriteCond %{HTTPS} off
RewriteCond %{HTTP_HOST} ^(www\.)?maindomain\.com$ [NC]
RewriteRule ^$$1 [R,L]
RewriteCond %{HTTPS} off
RewriteCond %{HTTP_HOST} ^(www\.)?firstaddondomain\.com$ [NC]
RewriteRule ^$$1 [R,L]

UPDATE: "#"s in original post were a mistake with the post, not the code.

SECOND UPDATE: Thanks for your answer, anubhava. My first addon domain is actually a .org domain, so my updated .htaccess file is slightly different from your answer.

Your solution helped, but I'm still having some trouble. is now redirecting to which is what I wanted. But is also redirecting to https, but I do not want this second addon domain to redirect to https. I don't have a SSL certertificate for the second addon domain and the user is getting a warning.

I noticed that (note the www) is not redirecting to https which is good.

Here is my updated .htaccess file

RewriteEngine On

RewriteCond %{HTTPS} off
RewriteCond %{HTTP_HOST} ^(?:www\.)?firstaddondomain\.org$ [NC]
RewriteRule ^{REQUEST_URI} [R=302,L,NE]

RewriteCond %{HTTPS} off
RewriteCond %{HTTP_HOST} ^(?:www\.)?maindomain\.com$ [NC]
RewriteRule ^{REQUEST_URI} [R=302,L,NE]

.htaccess url rewriting for addon domains

I have a web hosting that is running multiple website. Suppose i have that is the main website under this other websites are running as addon domains.

Like i have another website that is that is addon domain. There is folder created corresponding to the domain

Now the problem is i want to add some .htaccess rule there is no rule defined for root website. I want to add rule only for that is addon domain.

i have placed my .htaccess to the folder here is what i wrote.

RewriteEngine On
RewriteBase /

RewriteCond %{HTTP_HOST} !^(www\.)?\.com$ [NC]

RewriteCond %{THE_REQUEST} /find\.php\?source=([^\s&]+)&destination=([^\s&]+) [NC]
RewriteRule ^ %1-%2.html? [R=302,L,NE]

RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^([^\s]+)-([^\s]+)?.html$ find.php?source=$1&destination=$2 [L,QSA]

This is not working i have searched a lot on google for this problem but no suggestions is working. Please help me to short out this problem.