Welcome to WebmasterWorld Guest from

Forum Moderators: Ocean10000 & incrediBILL & phranque

Message Too Old, No Replies

Dynamic htaccess

10:48 am on Jul 28, 2011 (gmt 0)

Preferred Member

10+ Year Member

joined:Dec 5, 2002
posts: 367
votes: 0

Dear all,

I have a question, hopefully your answer contradicts my expectations.

5 domains all point to the same directory on my server. Is it possible to load a unique .htaccess file per domain?
9:02 pm on July 28, 2011 (gmt 0)

Senior Member from US 

WebmasterWorld Senior Member lucy24 is a WebmasterWorld Top Contributor of All Time 5+ Year Member Top Contributors Of The Month

joined:Apr 9, 2011
votes: 586

You can't have more than one htaccess file in the same location. But how do the domains get pointed in the first place? Put the htaccesses back there-- or put the equivalent information in the five separate config files if they exist. Do all five domains live on the same server? The wording of the question was ambiguous.

Option B is to include some version of {THE_REQUEST} in each separate set of rules, so users get differently routed depending on what they originally asked for (as distinct from where they are now). I foresee an icky mess in this case.

Deeper, philosophical issue: if you want things to behave differently depending on where the request came from, you may be merging the requests too soon. Put all the domain-specific stuff back in the originating domain, and reserve that final directory for things that will be handled exactly the same regardless of source.