|
|
|||||||||
|
|||||||||
| |||||||||
|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
#1
|
|||
|
|||
|
Setting up sub domains in apache
I am using Apache on Windows 2000, I currently have a webhost, Modwest.com, that allows unlimited sub domains. In their system, all I have to do is add anotherdirectory under the htdocs directory to create a sub domain. The inifial directories created in the htdocs directory are "www" and "_" -- which points to "www" so my site can be accessed through www.domain.com or just domain.com. Furthermore, if I have the following directories under htdocs, (sub1, sub2, sub3) I can access the files in those directories by going to sub1.domain.com, sub2.domain.com, sub3.domain.com.
Is this something that is possible to set up on my Apache/Windows 2000 configuration? Last edited by sweeting : March 11th, 2002 at 02:57 PM. |
|
#2
|
|||
|
|||
|
Yes, it's possible so try to read about vhost at http://httpd.apache.org/docs/vhosts/index.html .. If you can't understand or have problem, then post in here again..
![]() |
|
#3
|
|||
|
|||
|
of course it is!
this seems to me like a simple php/perl script setting up DNS entries in (99% confident) /var/named/ and virtualhosts (40%) /etc/httpd/virtual.conf you can search in this forum for "url rewriting", the most recent posts answered by freebsd contain the exact way if i remember correctly.
__________________
-- Manuel Hirsch - Linux, FreeBSD, programming, administration articles, tutorials and more. |
|
#4
|
|||
|
|||
|
Something like this:
Code:
RewriteEngine on
RewriteMap lc int:tolower
RewriteCond %{HTTP_HOST} ^domain\.com$ [NC]
RewriteRule ^(.+) - [L]
RewriteCond %{HTTP_HOST} !\.domain\.com$ [NC]
RewriteRule ^(.+) - [L]
RewriteCond %{HTTP_HOST} ^[^.]+\.domain\.com$ [NC]
RewriteRule ^/icons/(.+) - [PT,L]
RewriteRule ^(.+) %{HTTP_HOST}=$1 [C]
RewriteRule ^(.*)=(.*) ${lc:$1}$2 [C]
RewriteRule ^([^.]+)\.domain\.com(.*) /server/path/to/htdocs/$1$2
>> all I have to do is add anotherdirectory under the htdocs directory This is a bad setup and not efficient. You should move them one directory level up. |
|
#5
|
||||
|
||||
|
Okay, I have been looking at configurations at this URL:
http://httpd.apache.org/docs/vhosts/mass.html The text there seems to be what I am wanting to do... Quote:
The problem is, I am not sure which one to use. I tried putting the following in my httpd.conf, but it didn't work. Code:
RewriteEngine on
RewriteMap lc int:tolower
RewriteCond %{HTTP_HOST} ^domain\.com$ [NC]
RewriteRule ^(.+) - [L]
RewriteCond %{HTTP_HOST} !\.domain\.com$ [NC]
RewriteRule ^(.+) - [L]
RewriteCond %{HTTP_HOST} ^[^.]+\.domain\.com$ [NC]
RewriteRule ^/icons/(.+) - [PT,L]
RewriteRule ^(.+) %{HTTP_HOST}=$1 [C]
RewriteRule ^(.*)=(.*) ${lc:$1}$2 [C]
RewriteRule ^([^.]+)\.domain\.com(.*) /server/path/to/htdocs/$1$2
Note: I uncommented the line: "LoadModule rewrite_module modules/mod_rewrite.so" and I adjusted the domain.com to my domain name. When I restarted Apache after this, I received this error: Quote:
Any help with this would be appreciated. By the way, please remember that I am using Apache on WINDOWS. Thanks! |
|
#6
|
|||
|
|||
|
>> I am not sure which one to use
Try them both, they both are dynamic without restarting Apache. >> Invalid command 'RewriteEngine' Then mod_rewrite is not available. Keep in mind, mod_rewrite is not a default module. |
![]() |
| Viewing: Dev Shed Forums > System Administration > Apache Development > Setting up sub domains in apache |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|