httpd-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Ben Yau" <b...@cardcommerce.com>
Subject RE: [users@httpd] Subdomains of a hostname - possible?
Date Mon, 12 Jan 2004 21:58:04 GMT
>
> I have a site whose pages contain absolute links for items such as
> pages, images, stylesheets etc.
>
> e.g.
>
> 	<img src="/images/title.jpg" />
>
> This works fine if accessed from a proper domain (eg
> http://www.asa.co.uk) or from a subdomain (eg http://site1.asa.co.uk)
>
> I have an offline development system setup with LAMP with which I am
> attempting to setup subdomains which will work directly off that machine.
>
> What I would like users to be able to do is enter the following into
> their browser:
>
> 	http://mymachine/site1/
>
> and have it access a local subdomain, eg
>
> 	http://site1.mymachine
>
> The main virtual host I have setup for the machine is as follows:
>
> 	<VirtualHost 192.168.1.138>
> 		DocumentRoot /www.main/www
> 		ServerName mymachine
> 	</VirtualHost>
> 	<Directory "/www.main/www">
> 		AllowOverride All
> 	</Directory>
>
> This works fine. I thought I could set up another virtual host for this
> new subdomain as follows but it doesn't work:
>
> 	<VirtualHost 192.168.1.138>
> 		DocumentRoot /www.site1/www
> 		ServerName site1.mymachine
> 	</VirtualHost>
> 	<Directory "/www.site1/www">
> 		AllowOverride All
> 	</Directory>
>
> It doesn't matter if I have to setup/change hosts files as long as I can
> get the set up to work.
>
> Any suggestions as to how other people manage this would be greatly
> appreciated.
>

What exactly is not working?
Is it http://mymachine/site1 or http://site1.mymachin or both?
I'm guessing the first is not working but the second one is.  You may have
to add a rewrite rule in to rewrite
http://mymachine/[string] to go to http://[string1].mymachine and then make
sure all your http://[string1].mymachine virtual hosts are set up correctly.

Another way to do it is just do redirects

create
http://mymachine/[string]/index.html
and in the index.html make a
<meta http-equiv="refresh" url="0;http://[string].mymachine">
Again you need to make sure http://[string1].mymachine is a valid virtual
host


>


---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
   "   from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org


Mime
View raw message