PDA

View Full Version : .htaccess use subfolder for primary folder (with a slight twist)



dsexton1055
05-12-2009, 09:36 PM
Ok, first i want to say i love hostmonster support. They are freaking awesome. Figured i would ask here because what i am looking to do is not 100% on hostmonster servers and... well... i think they have seen my name on a support ticket a few times too many in the last couple of days.

http://helpdesk.hostmonster.com/kb/index.php?mod_id=2&id=308&kb_rating=yes

I reviewed this article and attempted to make this work using a subdomain. Didnt seem to do it. Let me set out exactly whats going on before i can explain what i am trying to do and why i am doing it. >.>

I have 2 sections of my site that are best not run on hostmonster for... basically firewall reasons. So by some miracle i got these linux systems to run on windows server x64. I have 2 subdomains setup for each section of the site there. One is in the main directory but the other is in a seperate folder. Is it possible to have a subdomain redirect like a primary domain via this .htaccess script? or is there something else i would need to do?

I left everything a bit vague because i havnt fully reviewed the TOS for this forum and i dont feel like breaking some rules ;)

shadmego
05-12-2009, 10:25 PM
Well, vaguely, if you are redirecting a subdomain to an external server, then your .htaccess file and subsequent rules will need to be located on that remote server.

... if that is what you are asking ...

~regards, and welcome to the community

dsexton1055
05-12-2009, 10:55 PM
Well, vaguely, if you are redirecting a subdomain to an external server, then your .htaccess file and subsequent rules will need to be located on that remote server.

... if that is what you are asking ...

~regards, and welcome to the community

actually i have all the files including the .htaccess file on the remote server.

Thanks for the welcome

shadmego
05-12-2009, 11:12 PM
if that is the case, then I would *think* that you will need to change the CNAME value for the subdomain to point to the IP address of the remote server:

subdomain.primary.com. CNAME VALUE: XXX.XXX.XXX.XXX (where the X's are the IP address of the remote server.

To get this set up, you will need to get Hostmonster to enter this value ... though you might need to make sure your remote server is assigned a static IP address. If it's dynamic, then you will have to constantly monitor the IP address for changes and get Hostmonster to update the CNAME accordingly.

You can try to do a redirect from inside CPanel for the subdomain to "redirect" to the remote server, but then you will have issues trying to get the URL and .htaccess file working properly.

Your best bet to get what you want is to use the CNAME change for the subdomain. I know Hostmonster will change these values for you, but I do not know if they will for subdomains. It should be possible .... but I caution you ... it *should be* possible.

~regards

dsexton1055
05-13-2009, 12:03 AM
thats what i get for being vague.

i have the subdomains setup to go to the IP address properly (i did need hostmonster to do that for me). Basically (im probably gonna get slapped for doing this... but...) i need hlstats.pantless-gaming.com to point to ** removed **/hlstats but act like it isnt 1 folder in a tree. Want it to act like its the primary folder. Currently both subdomains point to the same place.

shadmego
05-13-2009, 01:00 AM
so, if I am understanding you ...

you want hlstats.pantless-gaming.com to load XX.XX.XX.XX/hlstats/hlstats.php, without letting it look like the former.

I tried to load the subdomain in a browser and got one site.

I loaded the IP/folder address in my browser and the URL redirected to IP.add.re.ss/folder/hlstats.php, which was different from the above.

I then loaded hlstats.pantless-gaming.com/hlstats in my browser and it redirected to the aforementioned site: hlstats.pantless-gaming.com/hlstats/hlstats.php

I am assuming you want to load the last address but have it show up as:

hlstats.pantless-gaming.com

??

dsexton1055
05-13-2009, 01:07 AM
so, if I am understanding you ...

you want hlstats.pantless-gaming.com to load XX.XX.XX.XX/hlstats/hlstats.php, without letting it look like the former.

I tried to load the subdomain in a browser and got one site.

I loaded the IP/folder address in my browser and the URL redirected to IP.add.re.ss/folder/hlstats.php, which was different from the above.

I then loaded hlstats.pantless-gaming.com/hlstats in my browser and it redirected to the aforementioned site: hlstats.pantless-gaming.com/hlstats/hlstats.php

I am assuming you want to load the last address but have it show up as:

hlstats.pantless-gaming.com

??

exactly what im looking for.

actually im not worried about that IP getting out. its a super locked-down server colocated in chicago.

shadmego
05-13-2009, 01:15 AM
Ok.

Let's see if we can get this working ...

First, you will have to set up the remote (Chicago) server to load the hlstats.php as an index file.

Depending on the level of access you have on the server, and its configuration/set up, you will want to change either the httpd.conf file or put the following file inside the .htaccess:



DirectoryIndex index.php index.html hlstats.php

(ref: This link (http://www.hostmonsterforum.com/showthread.php?p=26533#post26533))

After that, you will want to set up your .htaccess file, again on the remote (Chicago) server, to redirect to the hlstats folder and also to rewrite the url to remove the hlstats folder reference. For this, you should be able to follow the helpdesk page you referenced before.

Hows that sound?

dsexton1055
05-13-2009, 01:50 AM
Ok.

Let's see if we can get this working ...

First, you will have to set up the remote (Chicago) server to load the hlstats.php as an index file.

Depending on the level of access you have on the server, and its configuration/set up, you will want to change either the httpd.conf file or put the following file inside the .htaccess:



DirectoryIndex index.php index.html hlstats.php

(ref: This link (http://www.hostmonsterforum.com/showthread.php?p=26533#post26533))

After that, you will want to set up your .htaccess file, again on the remote (Chicago) server, to redirect to the hlstats folder and also to rewrite the url to remove the hlstats folder reference. For this, you should be able to follow the helpdesk page you referenced before.

Hows that sound?

Full and unrestricted access.

AHA! I see what the problem was. Was about to post saying it didnt work right then i realized that i missed a line in the .htaccess.

Working now. Thanks!

Curious. Are there only 2 public viewable forums here?

shadmego
05-13-2009, 01:56 AM
Full and unrestricted access.

AHA! I see what the problem was. Was about to post saying it didnt work right then i realized that i missed a line in the .htaccess.

Working now. Thanks!

Awesome!


Curious. Are there only 2 public viewable forums here?

Indeed