Go Back   HostGator Peer Support Forums > Public Forums > Suggestions

Notices

Reply
 
Thread Tools
  #1  
Old 07-23-2008, 07:51 AM
visitor visitor is offline
Hatchling Croc
 
Join Date: Apr 2008
Posts: 28
Thumbs down .htaccess addon domains

This is a big problem now, and I find it strange why customer services cant help with it.

http://www.domain.co.uk is the main domain
http://www.domain.us is an addon domain

Both are working

cpanel makes a folder called "domainus" where all the files for http://www.domain.us are stored

However, I want to stop access to that folder from the main domain

http://www.domain.co.uk/domainus/ will show the pages, Ive tried the cpanel redirect and it dont do anything, no good to change the index.html as all other files would still be available

Did a search for .htaccess to change this, and tried many combanations none work.

Am I missing something here ? cpanel not working, and .htaccess tests none work, when perhaps they should ?

http://www.domain.co.uk/domainus/*.* should all go to http://www.domain.us/*.*

I need a .htaccess lines to fix this?
Reply With Quote
  #2  
Old 07-23-2008, 08:38 AM
striddy's Avatar
striddy striddy is offline
Veteran Croc
 
Join Date: Mar 2008
Location: /home/australia/earth
Posts: 4,040
Default Re: .htaccess addon domains

Quote:
Originally Posted by visitor View Post
This is a big problem now, and I find it strange why customer services cant help with it.
I assume you have put in a support ticket ??

Quote:
Originally Posted by visitor View Post
cpanel makes a folder called "domainus" where all the files for http://www.domain.us are stored

However, I want to stop access to that folder from the main domain

....

Am I missing something here ? cpanel not working, and .htaccess tests none work, when perhaps they should ?
The redirect tool in cpanel should work for this. Check your existing .htaccess doesn't have any strange commands which may be causing you grief.
__________________
- David
Reply With Quote
  #3  
Old 07-23-2008, 08:52 AM
slapshotw's Avatar
slapshotw slapshotw is offline
Veteran Croc
 
Join Date: Jun 2006
Posts: 5,164
Default Re: .htaccess addon domains

I agree about the redirect tool in cPanel. It should be fine for this-- can you give us the settings you're using? Also are you using the cPanel 11 theme? Confirm with support that you are, because it has a better redirect tool.
__________________
Follow me on Twitter! http://twitter.com/mrw
Reply With Quote
  #4  
Old 07-23-2008, 09:24 AM
visitor visitor is offline
Hatchling Croc
 
Join Date: Apr 2008
Posts: 28
Default Re: .htaccess addon domains

Hi

Well I just got two emails from support, and for some reason they talking about someting else, on about one of the domains not registerd or something its driving me mad now.

What started off as a google error has become a big problem

OK here is my .htaccess

RewriteEngine on

Rewritecond %{DOCUMENT_ROOT}%{REQUEST_URI} !-f
RewriteRule .php$ /404.php

SetEnv TZ Europe/London

RewriteCond %{HTTP_REFERER} !^$
RewriteCond %{HTTP_REFERER} !^http://maindomain.co.uk/.*$ [NC]
RewriteCond %{HTTP_REFERER} !^http://maindomain.co.uk$ [NC]
RewriteCond %{HTTP_REFERER} !^http://www.maindomain.co.uk/.*$ [NC]
RewriteCond %{HTTP_REFERER} !^http://www.maindomain.co.uk$ [NC]
RewriteRule .*\.(jpg|jpeg|gif|png|bmp)$ - [F,NC]

ErrorDocument 400 /400.shtml
ErrorDocument 401 /401.shtml
ErrorDocument 404 /404.php
ErrorDocument 500 /500.shtml


rewritecond %{http_host} ^maindomain.co.uk [nc]
rewriterule ^(.*)$ http://www.maindomain.co.uk/$1 [r=301,nc]


Now all that is working 100% no problems. So Im trying to add to that a way to redirect the addondomain folder, I cant give an example now has I have tried about 50+ and none work

cPanel Build 11.23.4-STABLE 26138
cPanel Pro 1.0 (RC1)
Theme cPanel X v2.6.0

There are people out there saying "this works >" but it dont

I started with live chat here, they didnt help at all so made a new ticket, and the very first thing they said that domain1.co.uk isnt registerd or something like that.

Dont know where cpanel makes its changes, but its not to the .htaccess file im reading, as there was no update, even when I made it blank?

Last edited by visitor; 07-23-2008 at 09:27 AM.
Reply With Quote
  #5  
Old 07-23-2008, 09:34 AM
visitor visitor is offline
Hatchling Croc
 
Join Date: Apr 2008
Posts: 28
Default Re: .htaccess addon domains

Ah, just an update on this, I may have missed it. I deleted the .htaccess file then tried again with cpanel. It made a new .htaccess with this

RewriteCond %{HTTP_HOST} ^.*$
RewriteRule ^domainfolder/?$ "http\:\/\/www\.addondomain\.us" [R=301,L]

It didt work though, ill try it without a / in cpanel
Reply With Quote
  #6  
Old 07-23-2008, 09:34 AM
slapshotw's Avatar
slapshotw slapshotw is offline
Veteran Croc
 
Join Date: Jun 2006
Posts: 5,164
Default Re: .htaccess addon domains

Ask Support to bring you to the X3 theme, then try again.
__________________
Follow me on Twitter! http://twitter.com/mrw
Reply With Quote
  #7  
Old 07-23-2008, 09:40 AM
visitor visitor is offline
Hatchling Croc
 
Join Date: Apr 2008
Posts: 28
Default Re: .htaccess addon domains

Ok, seams I was wrong, Cpanel is adding its code to the end of mine, but its just not doing anything.

RewriteCond %{HTTP_HOST} ^.*$
RewriteRule ^domainfolder/?$ "http\:\/\/www\.addondomain\.us" [R=301,L]

Dont do a thing

www.maindomain.co.uk/domainfolder/ still shows its contents and dont redirect

domainfolder = addondomain folder name

Quote:
Ask Support to bring you to the X3 theme, then try again.
Do you think its going to write some other code ?
Reply With Quote
  #8  
Old 07-23-2008, 10:29 AM
slapshotw's Avatar
slapshotw slapshotw is offline
Veteran Croc
 
Join Date: Jun 2006
Posts: 5,164
Default Re: .htaccess addon domains

I think it may write better code and give you more options. There's no harm in trying.

Also, try temporarily clearing out your .htaccess (make sure to save the contents!) and only putting in the cPanel code. If it works, something already in there is interfering with it.
__________________
Follow me on Twitter! http://twitter.com/mrw
Reply With Quote
  #9  
Old 07-23-2008, 04:55 PM
visitor visitor is offline
Hatchling Croc
 
Join Date: Apr 2008
Posts: 28
Default Re: .htaccess addon domains

Hi

Its been a long day, they updated cpanel, and now I cant find anything so need to spend some time looking at it.

They also gave be some code, but it goes inside the folder of the addon domain not the main domain, and its part working now

RewriteEnginge On
RewriteCond %{HTTP_HOST} maindomain.co.uk [NC]
RewriteRule ^(.*)$ http://www.addondomain.us [R=301,L]

Just needs a little tweek, as its not forwarding to the same "file"

www.maindomain.co.uk/addondomain/ ok
http://www.maindomain.co.uk/addondom...ome/index.html (just goes to the index of the addon domain)

I did delete the .htaccess but cpanel only changes the main domain anyway, so no use there if its the addon domain that needs the edit.

I replies to see if this can be done. The trouble is (If it is trouble) my main domain is number one in Google, and if I start putting the same pages in the .us domain they might just hurt the ranking

I can cope with sub domains ok...

Now I just clecked something in the new cpanel and have a network icon on my PC to ftp.fifi.org so now have to learn even more after this update.

I dont seam to be able to find the bit where I could check any server erros, like 777 problems?
Reply With Quote
  #10  
Old 07-23-2008, 04:56 PM
visitor visitor is offline
Hatchling Croc
 
Join Date: Apr 2008
Posts: 28
Default Re: .htaccess addon domains

Quote:
Thank you for posting! Your post will not be visible until a moderator has approved it for posting.
Who turns that on ? wasnt there before
Reply With Quote
  #11  
Old 07-23-2008, 04:57 PM
visitor visitor is offline
Hatchling Croc
 
Join Date: Apr 2008
Posts: 28
Default Re: .htaccess addon domains

? huh and I posted something before that too ?
Reply With Quote
  #12  
Old 07-23-2008, 05:56 PM
slapshotw's Avatar
slapshotw slapshotw is offline
Veteran Croc
 
Join Date: Jun 2006
Posts: 5,164
Default Re: .htaccess addon domains

Perhaps there was an image or other "blacklist" word in your post.
__________________
Follow me on Twitter! http://twitter.com/mrw
Reply With Quote
  #13  
Old 07-24-2008, 10:08 AM
visitor visitor is offline
Hatchling Croc
 
Join Date: Apr 2008
Posts: 28
Default Re: .htaccess addon domains

Ok..

I asked how I could change the code to foward to the right page

Quote:
RewriteCond %{HTTP_HOST} maindomain.co.uk [NC]
RewriteRule ^(.*)$ http://www.addondomain.us [R=301,L]
Thats sending everything to the index page.. almost there
Reply With Quote
  #14  
Old 07-24-2008, 10:22 AM
visitor visitor is offline
Hatchling Croc
 
Join Date: Apr 2008
Posts: 28
Default Re: .htaccess addon domains

Ok, got it at last

Quote:
RewriteCond %{HTTP_HOST} maindomain.co.uk [NC]
RewriteRule ^(.*)$ http://www.addondomain.us/$1 [R=301,L]
Reply With Quote
  #15  
Old 07-24-2008, 11:45 AM
visitor visitor is offline
Hatchling Croc
 
Join Date: Apr 2008
Posts: 28
Default Re: .htaccess addon domains

Still one problem, leave out a / and there is an error

www.domain.co.uk/addondomainfolder/test/ OK
www.domain.co.uk/addondomainfolder/test not ok
Reply With Quote
  #16  
Old 07-25-2008, 01:33 AM
slapshotw's Avatar
slapshotw slapshotw is offline
Veteran Croc
 
Join Date: Jun 2006
Posts: 5,164
Default Re: .htaccess addon domains

Put a redirect line before that one-- redirect non / to /, and then the next line will automatically grab it.
__________________
Follow me on Twitter! http://twitter.com/mrw
Reply With Quote
  #17  
Old 07-25-2008, 03:06 AM
visitor visitor is offline
Hatchling Croc
 
Join Date: Apr 2008
Posts: 28
Default Re: .htaccess addon domains

Sorry dont understand what your saying...

They did this now

Quote:
RewriteCond %{HTTP_HOST} ^(www\.)maaindomain.co.uk [NC]
RewriteRule ^(.*)$ http://www.addondomain.us/ [R=301,L]
and thats worce it sends everything to the index again, and the non www dont work at all.

You would think after all these years they would know, not sure if this can be done in just 2 lines
Reply With Quote
  #18  
Old 07-25-2008, 07:42 AM
GvilleRick's Avatar
GvilleRick GvilleRick is offline
Emperor Croc
 
Join Date: Jan 2007
Location: Greenville, SC
Posts: 3,128
Default Re: .htaccess addon domains

Quote:
Originally Posted by visitor View Post
You would think after all these years they would know, not sure if this can be done in just 2 lines
Who is "they"? If support is working on this then I would say they are going beyond what should be expected. This is a coding issue and I do not expect a hosting company support coding. This is especially true since you stated in the first post that the main domain and the addon domain were both working. You are trying now to use .htaccess to cover up default cPanel behavior when using an addon domain. If you really want the accounts completely separate then purchase another hosting account or get a reseller account and set them up separately.
Reply With Quote
  #19  
Old 07-25-2008, 08:56 AM
slapshotw's Avatar
slapshotw slapshotw is offline
Veteran Croc
 
Join Date: Jun 2006
Posts: 5,164
Default Re: .htaccess addon domains

I would try this as the first line of your .htaccess:

Code:
Redirect 301 /addondomainfolder/test http://www.domain.co.uk/addondomainfolder/test/
__________________
Follow me on Twitter! http://twitter.com/mrw

Last edited by slapshotw; 07-25-2008 at 08:59 AM.
Reply With Quote
  #20  
Old 07-25-2008, 11:06 AM
visitor visitor is offline
Hatchling Croc
 
Join Date: Apr 2008
Posts: 28
Default Re: .htaccess addon domains

GvilleRick, if you have no helpfull info please dont clog up the thread. No main domain should load a addon domain.

Slapshotw, thanks I will try that code now, but I dont know if can cope with all problems. Thinking its not going to work with just two lines, I added 4 lines, and now its almost fixed

Quote:
RewriteCond %{http_host} ^maindomain.co.uk [nc]
RewriteRule ^(.*)$ http://www.addondoamin.us/$1 [r=301,nc]
RewriteCond %{http_host} ^www.maindomain.co.uk [nc]
RewriteRule ^(.*)$ http://www.addondomain.us/$1 [r=301,nc]
This is 95%
These redirect 100%
http://www.maindomain.co.uk/addondomain/
http://www.maindomain.co.uk/addondomain/welcome/
http://www.maindomain.co.uk/addondomain/welcome
http://www.maindomain.co.uk/addondom...ome/index.html

Sadly this one shows the Public_Html path and username path
http://www.maindomain.co.uk/addondomain
Reply With Quote
  #21  
Old 07-25-2008, 11:08 AM
visitor visitor is offline
Hatchling Croc
 
Join Date: Apr 2008
Posts: 28
Default Re: .htaccess addon domains

waiting for my post here to be approved AGAIN
Reply With Quote
  #22  
Old 07-25-2008, 11:14 AM
visitor visitor is offline
Hatchling Croc
 
Join Date: Apr 2008
Posts: 28
Default Re: .htaccess addon domains

Code:
RewriteCond %{http_host} ^maindomain.co.uk [nc]
RewriteRule ^(.*)$ http://www.addondomain.us/$1 [r=301,nc]

RewriteCond %{http_host} ^www.maindomain.co.uk [nc]
RewriteRule ^(.*)$ http://www.addondomain.us/$1 [r=301,nc]
all others work except this
Code:
http://www.maindomain.co.uk/addondomain
No / on that one

I get this

Code:
http://www.addondomain.us//home/username/public_html/addondomain
Reply With Quote
  #23  
Old 07-25-2008, 03:30 PM
slapshotw's Avatar
slapshotw slapshotw is offline
Veteran Croc
 
Join Date: Jun 2006
Posts: 5,164
Default Re: .htaccess addon domains

Did you use my redirect line successfully? Can you put in another one for the final one that doesn't work?
__________________
Follow me on Twitter! http://twitter.com/mrw
Reply With Quote
  #24  
Old 07-25-2008, 03:38 PM
kompreszor's Avatar
kompreszor kompreszor is offline
Swamp Croc
 
Join Date: Jun 2007
Location: Pennsylvania, USA
Posts: 330
Default Re: .htaccess addon domains

Try this...
Code:
<IfModule mod_security.c>
# Turn the filtering engine On or Off
SecFilterEngine On
# Rule to redirect sub-directory to add-on Domain
SecFilterSelective REQUEST_URI "/AddOnDirectory$" "redirect:http://addondomain.com"
</IfModule>
__________________
“There is a principle which is a bar against all information, which is proof against all arguments and which cannot fail to keep a man in everlasting ignorance—that principle is contempt prior to investigation.”
—Herbert Spencer
Reply With Quote
  #25  
Old 07-27-2008, 11:59 AM
visitor visitor is offline
Hatchling Croc
 
Join Date: Apr 2008
Posts: 28
Default Re: .htaccess addon domains

Quote:
Originally Posted by slapshotw View Post
Did you use my redirect line successfully? Can you put in another one for the final one that doesn't work?
Hi

Sorry, been to the beach for 2 days so looking into this again now, but its very hot here

Quote:
Redirect 301 /addondomainfolder/test http://www.domain.co.uk/addondomainfolder/test/
Not sure what you want me to do there ? where does /test come into ?

Remember, there may be thosands of files, and 50+ folders, so I cant write a rule for each file or folder.

Im testing this out on just one addon domain, and hope to get it to work with my other addon domains. I have many accounts with hostgator, and around 30 domains spread accross them, also some sub domains.

Im looking at "what if" and perhaps some damidge already done in the search engines. The one Im working on has only 2 domains on this account, the main domain is number one in google search, I want it to stay that way

So what if
Its only the second line above thats not working, and I think ive already added the correct code to take take of it in line 3

1,3,4,5 are working, so why line 2 still wont work.

Quote:
Originally Posted by kompreszor View Post
Try this...
Code:
<IfModule mod_security.c>
# Turn the filtering engine On or Off
SecFilterEngine On
# Rule to redirect sub-directory to add-on Domain
SecFilterSelective REQUEST_URI "/AddOnDirectory$" "redirect:http://addondomain.com"
</IfModule>
Well that will work for the basic, but it cant handle the /anotherfolder/ like my examples.

Thanks both

Last edited by visitor; 07-27-2008 at 12:02 PM.
Reply With Quote
Reply

Bookmarks

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Fascinating problem with .htaccess and addon domain paradigm Shared Hosting Support 14 04-08-2010 10:02 AM
redirecting .htaccess addon domain problem PhxStorks Shared Hosting Support 5 06-25-2008 03:01 PM
htaccess ...... multi domains ???? leftie Shared Hosting Support 7 06-05-2008 03:09 PM

All times are GMT -6. The time now is 04:20 AM.