PDA

View Full Version : Link To Sub-Domains


noned2argu
09-20-2002, 11:28 AM
Link To Sub-Domains

Hi there, i am in a fix. i just started working on my site i have hosted.But i am having a brain fart. how do i link my Pages that are in a subdomain.

Geocities was soo easy you know
geocities.com/username/whatever1.htm/whatever2.htm

I uploaded to my site now i cant access the url.
example

*****y.domainname.com (not real my real site :))

where do i put my files in , say shall place them in the WWW folder or the public html folder, or
bithy folder thats in the public or www folder.

am i making sense?
am i losing my mind?

can anyone here be soo kind and help me.
I will name my first kid after ya, if an when i decide to have children.
Thanks
Norma
Noned2argue

bcarl314
09-20-2002, 12:03 PM
Well, it depends on how you have the subdomain set up. Here are 2 common methods:

1) subdomain on the same server (ie sub.mydomain.com and mydomain.com are on the same server)
You'll need to create a directory named "sub" (in this case) and then configure your server to point any "sub.mydomain.com" requests to that directory.

2) subdomain on a different server (ie sub.mydomain.com=155.155.155.1 and mydomain.com=155.155.155.155)
Here you'll need to modify your DNS record to point sub.mydomain.com to 155.155.155.1 and mydomain.com to 155.155.155.155.

To configure #1, you'll need to let us know what type of server your on. (IIS, Apache and so forth) For #2 all you need is 2 different web servers (hosts)

noned2argu
09-20-2002, 12:42 PM
1) You'll need to create a directory named "sub" (in this case) and then configure your server to point any "sub.mydomain.com" requests to that directory.

ok done that

2) subdomain on a different server (ie sub.mydomain.com=155.155.155.1 and mydomain.com=155.155.155.155)
Here you'll need to modify your DNS record to point sub.mydomain.com to 155.155.155.1 and mydomain.com to 155.155.155.155.

lemme see , my DNS has the same amount of digits
xxx.xxx.xxx.xx3
xxx.xxx.xxx.xx4

To configure #1, you'll need to let us know what type of server your on. (IIS, Apache and so forth)

i am sure its apache

MCookie
09-20-2002, 02:07 PM
Your subdomain isn't on another server, is it? Don't think so.. so forget about the DNS.
If your server is Apache you can use a .htaccess.

If you never heard of .htaccess before, here is Feyd's tutorial:
http://www.wsabstract.com/howto/htaccess.shtml

But he doesn't tell you how to create subdomains. This works for me:
(Read the tutorial first!)


RewriteEngine On
RewriteCond %{HTTP_HOST} ^subdomain.domain.com$
RewriteCond %{REQUEST_URI} !^/subdomain/
RewriteRule (.*) /subdomain/$1

Where it says subdomain, put the name of your subdomain, where it says domain.com, put the name of your domain. Typing in subdomain.domain.com will take you to domain.com/subdomain/

Subdomain is the directory you already made in your public_html folder..

scouchman
11-12-2002, 10:17 PM
My webserver is running Apache and I successfully used the code provided, but now I want to use it for multiple subdomains, and the code doesn't seen to work. Here's what I put in my .htaccess file:

RewriteEngine On
RewriteCond %{HTTP_HOST} ^sub1.domain.com$
RewriteCond %{REQUEST_URI} !^/sub1/
RewriteRule (.*) /sub1/$1
RewriteCond %{HTTP_HOST} ^sub2.domain.com$
RewriteCond %{REQUEST_URI} !^/sub2/
RewriteRule (.*) /sub2/$1

I've also tried adding a second "RewriteEngine On" at the start of the second domain.

[pauses while checking something]

Well, I just tried it straight and might have found my issue. I just created the sub2 domain today and it may be taking its sweet time to replicate through the servers, because when I try it by itself, it still doesn't work. I'll try it again later.

But if there is something I'm missing above, here, any help would be appreciated.