Scorpion0x17
can detect anyone's visible post count...
+691|6783|Cambridge (UK)
I'm in the process of developing a website that will have 4 domains pointing at it - 1 primary, 3 secondary.

Now, each secondary domain needs to point to a sub-folder of the primary domain, thus:

Code:

www.exampleprimary.co.uk => /
www.examplesecondary1.co.uk => /secondary1/
www.examplesecondary2.co.uk => /secondary2/
www.examplesecondary3.co.uk => /secondary3/
The domain urls will be in that form (where the part after 'example' in the domain name is the subfolder for the secondary domains (though of course, those aren't the actual domain names))...

If my info is correct, the site will be hosted on an Apache server, and I believe this can be done with .htaccess commands or some such...

I've tried googling it (before anyone suggests that) but all the information I can find makes my head hurt and I can't see how to use it in my particular instance...

So, does anyone here know what I'm talking about? Can you explain what I need to do in layman's terms and with examples?

Last edited by Scorpion0x17 (2008-10-23 22:12:48)

OrangeHound
Busy doing highfalutin adminy stuff ...
+1,335|6666|Washington DC

This is a DNS issue ... you configure where your domain pointers through your registrar and your host provider's DNS system.

(I'm not sure if you are talking about a stand-alone machine, a virtual private machine, or a shared host).  But, unless you are running your own computer with an IP, you likely will need to go through your host provider to get these DNS pointers set.
Scorpion0x17
can detect anyone's visible post count...
+691|6783|Cambridge (UK)

OrangeHound wrote:

This is a DNS issue ... you configure where your domain points through your registrar and your host provider's DNS system.
I believe my host provider is looking into the possibility of doing it that way.

But, if there's a way it can be done with .htaccess commands, then in some ways I'd prefer that (then I can change things around easily).

OrangeHound wrote:

(I'm not sure if you are talking about a stand-alone machine, a virtual private machine, or a shared host)
I believe it's a shared host.

Last edited by Scorpion0x17 (2008-10-23 22:25:37)

OrangeHound
Busy doing highfalutin adminy stuff ...
+1,335|6666|Washington DC

Scorpion0x17 wrote:

OrangeHound wrote:

This is a DNS issue ... you configure where your domain points through your registrar and your host provider's DNS system.
I believe my host provider is looking into the possibility of doing it that way.

But, if there's a way it can be done with .htaccess commands, then in some ways I'd prefer that (then I can change things around easily).
I'll go out on a very strong limb here and say that the answer is no.  The .htacess file does not deal with internet routing issues, just with things such as permissions and redirects. 

This is a job for your host provider.  He has to create the DNS information for his machines, and then this DNS information that he creates is forwarded out to be merged with the larger tables of the internet.



Edit:  If you want to know how the DNS is configured, look up "BIND" for more information.  BIND is the name server process that most UNIX systems run ... at least, I'm pretty sure that's correct ... been a long time since I've dealt with any of this stuff.
Titch2349
iz me!
+358|6369|uk

All DNS does is point the website to the server that serves the request: However, it is the configuration of the webserver (apache, lighttpd), that specifies where the folder is that represents the domain.

On a decent shared host, you don't have to worry about the inner workings of domain routing- you point "www.example.com" to your server ip, and in your cPanel/ Plesk login you click "Add another domain", enter "www.example.com", and then specify the root folder of that domain to be "public_html/example.com". This method is all automated, very easy, and should your host not allow you to do this, leave.

If however, your desperate to do the dynamic thing, where the server is looking for "secondary1" in the domain, and automatically assigning the folder, then I would try to do it as follows...

Point all the domains examplesecondary1.co.uk, examplesecondary2.co.uk etc, to the same root folder as the exampleprimary.co.uk, and the use the .htaccess to configure the home directory.

Last edited by Titch2349 (2008-10-23 22:52:52)

=Karma-Kills=
"Don't post while intoxicated."
+356|6601|England
Assuming you have hosting accounts on all the domains (ie you can acess separate webspaces on each of the domains), then you could easily use .htacess to 301 redirect them. For example, this would be the code you upload to www.examplesecondary1.co.uk

redirect 301 /index.html http://www.exampleprimary.co.uk/secondary1/

Rinse and repeat.

Whatever you do, try to use server side code for redirects (search engines prefer it), and always use 301s (NOT 302s)
Scorpion0x17
can detect anyone's visible post count...
+691|6783|Cambridge (UK)

Titch2349 wrote:

All DNS does is point the website to the server that serves the request: However, it is the configuration of the webserver (apache, lighttpd), that specifies where the folder is that represents the domain.

On a decent shared host, you don't have to worry about the inner workings of domain routing- you point "www.example.com" to your server ip, and in your cPanel/ Plesk login you click "Add another domain", enter "www.example.com", and then specify the root folder of that domain to be "public_html/example.com". This method is all automated, very easy, and should your host not allow you to do this, leave.
Right, that's what I thought.

I previously had a domain registered and hosted through same company, but I didn't look into the multiple domains thing at the time, and can't remember what I was and was not allowed to do with it...

Titch2349 wrote:

If however, your desperate to do the dynamic thing, where the server is looking for "secondary1" in the domain, and automatically assigning the folder, then I would try to do it as follows...

Point all the domains examplesecondary1.co.uk, examplesecondary2.co.uk etc, to the same root folder as the exampleprimary.co.uk, and the use the .htaccess to configure the home directory.
I'm desperate to not do the dynamic thing, but will if I have to.

Trouble is, this side of things is all Greek to me - and I need to not have to spend weeks learning Apache configuration just to figure it out...

So, in case I do need to go down this route, how would one "use the .htaccess to configure the home directory"?
Scorpion0x17
can detect anyone's visible post count...
+691|6783|Cambridge (UK)

=Karma-Kills= wrote:

Assuming you have hosting accounts on all the domains (ie you can acess separate webspaces on each of the domains), then you could easily use .htacess to 301 redirect them. For example, this would be the code you upload to www.examplesecondary1.co.uk

redirect 301 /index.html http://www.exampleprimary.co.uk/secondary1/

Rinse and repeat.

Whatever you do, try to use server side code for redirects (search engines prefer it), and always use 301s (NOT 302s)
This is the one thing I definitely want to avoid having to do - firstly, because 1x hosting is cheaper than 4x hosting, but, secondly and more importantly, am I not right in thinking that using this method if the user types "www.examplesecondary1.co.uk" into their address bar, it will then change to show "www.exampleprimary.co.uk/secondary1/" - this is something I don't want - the individual sites are linked, both stylistically and thematically, but they each need to stand alone as wholly self-contained individual sites.
Titch2349
iz me!
+358|6369|uk

Scorpion0x17 wrote:

=Karma-Kills= wrote:

Assuming you have hosting accounts on all the domains (ie you can acess separate webspaces on each of the domains), then you could easily use .htacess to 301 redirect them. For example, this would be the code you upload to www.examplesecondary1.co.uk

redirect 301 /index.html http://www.exampleprimary.co.uk/secondary1/

Rinse and repeat.

Whatever you do, try to use server side code for redirects (search engines prefer it), and always use 301s (NOT 302s)
Am I not right in thinking that using this method if the user types "www.examplesecondary1.co.uk" into their address bar, it will then change to show "www.exampleprimary.co.uk/secondary1/" - this is something I don't want - the individual sites are linked, both stylistically and thematically, but they each need to stand alone as wholly self-contained individual sites.
301's and 302's will change the browser address bar from http://www.example.com/anothersite to http://www.anothersite.com.

There is some code you can do in the .htaccess file, which fetches files from another location on the server: Which is extremely similar to the process of a 301/ 302 redirect, except the address stays the same, and the user never knows they have been redirected.

However, I have re-read your post for a second time, and I am 99% sure there is no need for you to do any redirecting of any kind.

Since you are on shared hosting, there is a fairly good chance you use cPanel to manage your website; cPanel includes a facility to do exactly what you want to do, with a few simple clicks of a button (However, the server host that you are with, has the ability to remove the various functionailty of cPanel, so there is the possibility of this not been an option for you).

For an example... mattlunn.me.uk is my primary domain. (public_html/) is the root of that website. I have RoundCube webmail installed at public_html/rcmail. If you go to http://mattlunn.me.uk/rcmail, it will take you to my web mail login. I also have a subdomain- mail.mattlunn.me.uk, which points to public_html/rcmail- it doesnt matter if you go to mattlunn.me.uk/rcmail, or mail.mattlunn.me.uk; you still go to the same folder, get served the same files- but never know they refer to the same files.

This is what I look at when I look at my domain manager, and heres the demo account for the webhost im on- have a browse around to see what you can do!

Hope this helps some more

Last edited by Titch2349 (2008-10-24 09:32:11)

Board footer

Privacy Policy - © 2024 Jeff Minard