Web Hosting Talk







View Full Version : subdomain forwarding


kloh
12-27-2001, 02:30 PM
I previously used a service that provided subdomain forwarding, but my new host does not provide this feature. I am able to create actual subdomains, but can't use them to redirect to a specific page and/or another website. Does anyone know of a good way to do this?

sayap
12-27-2001, 03:04 PM
I think you can put a index.htm there with frame redirection

kloh
12-27-2001, 03:28 PM
I don't know much about coding (beyond html). Can you provide an example of what a redirect script might be? Or point me to a resource that might have them?

sayap
12-27-2001, 03:41 PM
<FRAMESET ROWS="100%, *" frameborder="no" framespacing=0 border=0>
<FRAME SRC="http://your_url_here" NAME="mainwindow" frameborder="no" framespacing="0" marginheight="0" marginwidth="0"></FRAME>
</FRAMESET>
<NOFRAMES><CENTER><H2>Your browser does not support frames. We recommend upgrading your browser.</H2>
<br><br>Click <a href="http://your_url_here">here</a> to enter the page</CENTER></NOFRAMES>


Make a index.htm look like the above, and upload it to your subdomain

should be working :)

kloh
12-27-2001, 03:57 PM
awesome. works like a charm. thanks, sayap.

Webdude
12-27-2001, 07:41 PM
Create an .htaccess file in the subdomain's root and use it to redirect. It's more efficient and faster... just do the following..



redirect accessed-file URL-to-go-to

IE:

redirect /weav/htaccess/redirect.html http://www.canowhoopass.com/




I setup an example of this at http://worldzonepro.com/redirect/index.html which redirects to yahoo.com. The line of code in the .htaccess is

redirect /redirect/index.html http://yahoo.com/

kloh
12-28-2001, 12:05 AM
very cool webdude, thanks... does seem to be more efficient since it's less code. Does this work with all browsers? And can you please clarify... I am unfamiliar with .htaccess files. Is that the only code required in index.html? does it require tags?

I also forgot to mention, I do have some DNS control via Web Host Manager. Is there anything I can do in terms of setting "CNAME" or "A" resource records to do the redirect instead of the above two suggestions?

Webdude
12-28-2001, 12:15 AM
Originally posted by kloh
very cool webdude, thanks... does seem to be more efficient since it's less code. Does this work with all browsers? And can you please clarify... I am unfamiliar with .htaccess files. Is that the only code required in index.html? does it require tags?

Yes it works for all browsers that I am aware of. As a matter of fact, the url http://worldzonepro.com/redirect/index.html doesnt even exist....not the directory (/redirect/) nor the index.html that would be in it.

I also forgot to mention, I do have some DNS control via Web Host Manager. Is there anything I can do in terms of setting "CNAME" or "A" resource records to do the redirect instead of the above two suggestions?

I'm sure there is. However, the .htaccess method is much easier to change if you ever need to. As a matter of fact, I dont even use my ResellPro.net/.com urls. I use .htaccess to redirect to a page on wzpro.net. If I ever want to change it, there is no dns issues to mess with.

There is also a way, I'm sure of it, to have it redirect to a different location like that, but without the url in the addy bar changing....and not with a frame either. As a matter of fact, I am figuring that out right now for resellpro.. I will post what I did once I have figured it out.....shouldnt take long. If you didnt understand that, let me put it a different way...I will have it so that resellpro can pull up yahoo, yet the addy in the bar be still resellpro.com.....and no framing involved.. Nothing is impossible, I will figure it out, I always do :cool:

Webdude
12-28-2001, 12:54 AM
Ha! I did it!!

<edit> gives you everything on yahoo.com with no redirect, no frame, and no copying of yahoo! It is exactly like going to yahoo.com itself..

Edit: nevermind, I screwed something up again...

kloh
12-28-2001, 01:10 AM
webdude - I am intrigued and confused at the same time :)

let me know when you figure it out. I was still getting yahoo.com in the address bar (mac IE 5.0)

Also, I'm still a bit confused about .htaccess files. Is it simply a text file named .htaccess with the redirect code placed in the root directory of the subdomain? Does it require any specific type of server or software in order to run? My host is on Linux.

By the way, your worldzone reseller program looks cool. If I hadn't just signed up with someone else I'd definitely give you a try.

-ken

Webdude
12-28-2001, 01:30 AM
Download, unzip, and upload the .htaccess file into your root web accessible folder (ie: www, public_html, whatever) at the subdomain or location you want redirected. It has to be named .htaccess with the dot at the beginning and nothing in front of it. Make sure you dont already have an htaccess file there. Any file with nothing but a dot in front is an invisible file on linux. You have to set the config in your ftp program to see these.

Webdude
12-28-2001, 01:34 AM
Sorry, forgot to upload the file...

kloh
12-28-2001, 02:04 AM
this is too cool, webdude.

I got it to work when I placed the .htaccess file in the subdomain root, but could not get it to work when I placed it (and altered it appropriately) in the main site root. So, I assume I can make multiple .htaccess files and place them in each subdomain to direct them appropriately? I was hoping I could make 1 file with all the various subdomain redirects, but maybe that's not possible.

Definitely let me know if you can figure out how to keep the address bar from showing the redirected URL instead of the subdomain.