logo
Apache Lounge
Webmasters

 

About Forum Index Downloads Search Register Log in RSS X


Keep Server Online

If you find the Apache Lounge, the downloads and overall help useful, please express your satisfaction with a donation.

or

Bitcoin

A donation makes a contribution towards the costs, the time and effort that's going in this site and building.

Thank You! Steffen

Your donations will help to keep this site alive and well, and continuing building binaries. Apache Lounge is not sponsored.
Post new topic   Forum Index -> Apache View previous topic :: View next topic
Reply to topic   Topic: htaccess for main domain not affect subdomanis
Author
ryanjenkin



Joined: 01 Jul 2015
Posts: 2

PostPosted: Wed 01 Jul '15 17:25    Post subject: htaccess for main domain not affect subdomanis Reply with quote

Hello,

I have maindomain.com addon-1.com addon-2.com addon-3.com

The addon domains are folders in main domain's root.

The problem is maindomain's htaccess is affecting the addon domains. I want the add on domains to have their own htaccess. The addon domains should not be influenced by main domain's htaccess

I did some research online and someone says this method works:

Code:

RewriteCond %{HTTP_HOST} ^(www\.)?addon_domain\.com
RewriteRule .* - [L]


But the above assumes you only have one addon domain. I have multiple.

Which code is correct? This
Code:

RewriteCond %{HTTP_HOST} ^(www\.)?addon-1\.com
RewriteRule .* - [L]
RewriteCond %{HTTP_HOST} ^(www\.)?addon-2\.com
RewriteRule .* - [L]
RewriteCond %{HTTP_HOST} ^(www\.)?addon-3\.com
RewriteRule .* - [L]


Or this

Code:
RewriteCond %{HTTP_HOST} ^(www\.)?addon-1\.com
RewriteCond %{HTTP_HOST} ^(www\.)?addon-2\.com
RewriteCond %{HTTP_HOST} ^(www\.)?addon-3\.com
RewriteRule .* - [L]


do I put the code at the beginning of main domain's htaccess?

Or maybe the above is all wrong and you have some other solution?
Back to top
glsmith
Moderator


Joined: 16 Oct 2007
Posts: 2268
Location: Sun Diego, USA

PostPosted: Thu 02 Jul '15 0:18    Post subject: Re: htaccess for main domain not affect subdomanis Reply with quote

ryanjenkin wrote:
The addon domains are folders in main domain's root.


There is your problem. As documented.

Better planning in your layout of where the document roots are going to be located is the only way to get around the problem.

Like maybe the main site's documentroot being htdocs/main
addon-1 documentroot being htdocs/addon-1
etc. etc.

this way the addon domains are not directly below the main one's in the directory tree.
Back to top
ryanjenkin



Joined: 01 Jul 2015
Posts: 2

PostPosted: Thu 02 Jul '15 2:13    Post subject: Re: htaccess for main domain not affect subdomanis Reply with quote

Thanks, I looked at the documentation that you linked to, but I am not understanding what it is I need to do. I understand the theory, if all domains are at the same level, then the htaccess files won't interfere with each other.
But I dont understand what I need to do to make this happen.
Back to top
glsmith
Moderator


Joined: 16 Oct 2007
Posts: 2268
Location: Sun Diego, USA

PostPosted: Fri 03 Jul '15 5:05    Post subject: Reply with quote

put them in separate folders, all of them. I need to ask though. These domains, are they using VirtualHosts to keep them separate or are you just pointing them to your IP and trying to have your one host separate them using rewriting?

If you are not using VirtualHosts and these are truly domains then you should be using virtualhosts.

And you can put them anywhere on the hard drive, they do not all have to be inside /htdocs. Many people have something like

C:\www <- nothing in here
C:\www\site1 <- document root for site1.com
C:\www\site2 <- document root for site2.com
C:\www\siteN <- document root for siteN.com
or
c:/Apache24/htdocs <- nothing in here
c:/Apache24/htdocs/main <- documentroot for mainsite.com
c:/Apache24/htdocs/addon-1 <- documentroot for addon-1.com
c:/Apache24/htdocs/addon-N <- documentroot for addon-N.com
Back to top


Reply to topic   Topic: htaccess for main domain not affect subdomanis View previous topic :: View next topic
Post new topic   Forum Index -> Apache