Go4Expert

Go4Expert (http://www.go4expert.com/)
-   Web Hosting (http://www.go4expert.com/forums/web-hosting-talk/)
-   -   How do I use .htaccess in the root folder without affecting sub-domains? (http://www.go4expert.com/forums/i-htaccess-root-folder-affecting-sub-t19545/)

medoomi 24Sep2009 20:15

How do I use .htaccess in the root folder without affecting sub-domains?
 
Hi,

The solution might be quite simple, but I'm having trouble locating it. Can anyone direct me the right place?

I host six websites with separate domains from one server (one of which is a primary domain, hosted in the root folder)

Presently, any .htaccess 301 folder re-directs that I put in the in the root folder affect not only the primary domain, but all sub-domains as well.

How do I avoid this?
Thanks.

shabbir 25Sep2009 09:48

Re: How do I use .htaccess in the root folder without affecting sub-domains?
 
There is a way you can Test the Host and only take action for your main host and not sub-domain.

seopeter 25Sep2009 14:09

Re: How do I use .htaccess in the root folder without affecting sub-domains?
 
Have you hosted direct or using any panel

shabbir 25Sep2009 14:18

Re: How do I use .htaccess in the root folder without affecting sub-domains?
 
Quote:

Originally Posted by seopeter (Post 57935)
Have you hosted direct or using any panel

Could not understand what you are asking?

medoomi 26Sep2009 03:11

Re: How do I use .htaccess in the root folder without affecting sub-domains?
 
Quote:

Originally Posted by shabbir (Post 57930)
There is a way you can Test the Host and only take action for your main host and not sub-domain.

Thanks so much for your reply. That sounds really helpful. Could you enlarge--I'm assuming you mean code for the .htaccess file. Do you know where I can look this up?

Thanks

shabbir 26Sep2009 10:04

Re: How do I use .htaccess in the root folder without affecting sub-domains?
 
You should use something like this
Code:

RewriteCond %{HTTP_HOST} my\.go4expert\.com$ [NC] 
RewriteRule ........


medoomi 26Sep2009 18:50

Re: How do I use .htaccess in the root folder without affecting sub-domains?
 
Quote:

Originally Posted by shabbir (Post 58001)
You should use something like this
Code:

RewriteCond %{HTTP_HOST} my\.go4expert\.com$ [NC] 
RewriteRule ........


I've tried the following, but can't figure why it's not working
(I'm not sure of the right way to write this. I put myhostname for the domain name without the http and myhostnamewithhttpatthefront for the domain name with the http)

Code:

RewriteCond %{HTTP_HOST} myhostname$ [NC]
RewriteRule /gallery.html myhostnamewithhttpatthefront/gallery.php [r=301,nc]


shabbir 27Sep2009 11:13

Re: How do I use .htaccess in the root folder without affecting sub-domains?
 
Probably then post the exact one but you would need double digit post count for that and making genuine posts in the forums can get you that easily

medoomi 28Sep2009 02:06

Re: How do I use .htaccess in the root folder without affecting sub-domains?
 
Quote:

Originally Posted by shabbir (Post 58029)
Probably then post the exact one but you would need double digit post count for that and making genuine posts in the forums can get you that easily

OK, cool, thanks for your replies (I quickly get over my head on this one :-) )

medoomi 30Sep2009 07:31

Re: How do I use .htaccess in the root folder without affecting sub-domains?
 
OK, I've got it running, using the following code:
(I didn't realise the backslashes were necessary for the periods), and that I should not begin the rewriterole with a forward slash)

RewriteCond %{HTTP_HOST} my\.go4expert\.com$ [NC]
RewriteRule ^gallery.html$ newurl [r=301,nc]


All times are GMT +5.5. The time now is 20:11.