LiteSpeed Technologies
Download Download     Blog Blog     Wiki Wiki     Forum Forum     Store     Contact Contact    

Go Back   LiteSpeed Support Forums > LiteSpeed Web Server > Install/Configuration > subdomains

Reply
 
Thread Tools Display Modes
  #1  
Old 12-03-2005, 06:56 AM
xinn xinn is offline
Member
 
Join Date: Aug 2005
Posts: 21
Default subdomains

Hello,
so far ive been setting up different vhosts for different subdomains. In near future, i will have to create 100+ small pages in one domain but on different subdomains. Here is my question. Is this possible to create one vhost to handle these subdomains? The rule should be:
domain.com : /home/domain/www/
sub1.domain.com /home/domain/www/sub1/
sub2.domain.com /home/domain/www/sub2/

Regards
Xinn
Reply With Quote
  #2  
Old 12-03-2005, 09:26 AM
mistwang mistwang is offline
LiteSpeed Staff
 
Join Date: May 2003
Location: New Jersey
Posts: 7,586
Yes, you can use some simple rewrite rules to do it.
You can reference section "Simple dynamic virtual hosts using mod_rewrite" in
http://httpd.apache.org/docs/1.3/vhosts/mass.html
Reply With Quote
  #3  
Old 12-03-2005, 11:24 AM
xinn xinn is offline
Member
 
Join Date: Aug 2005
Posts: 21
Simple rules means a lot of work for me
I tried some configurations mentioned on this site... But they dont work for me..

This one would be ideal for me:

Quote:
RewriteEngine on

RewriteMap lowercase int:tolower

# allow CGIs to work
RewriteCond %{REQUEST_URI} !^/cgi-bin/

# check the hostname is right so that the RewriteRule works
RewriteCond ${lowercase:%{SERVER_NAME}} ^www\.[a-z-]+\.domain\.pl$

# concatenate the virtual host name onto the start of the URI
# the [C] means do the next rewrite on the result of this one
RewriteRule ^(.+) ${lowercase:%{SERVER_NAME}}$1 [C]

# now create the real file name
RewriteRule ^www\.([a-z-]+)\.domain\.pl/(.*) /home/domain/public_html/$1
Any ideas how to force it to work?
Reply With Quote
  #4  
Old 12-03-2005, 01:19 PM
mistwang mistwang is offline
LiteSpeed Staff
 
Join Date: May 2003
Location: New Jersey
Posts: 7,586
There is a bug in rewritemap will be fixed in next release, but you don't need to use the lowercase map, as the %{SERVER_NAME} has been converted to lowercase by LSWS already, so you can try:

Code:
RewriteCond %{SERVER_NAME} !^www\.us\.pl$
RewriteCond %{SERVER_NAME} ^(.*)\.us\.pl$
RewriteRule ^/(.*)$  /home/uspl/public_html/%1/$1
Set "Rewrite Log level" to "9" and check the error log to debug those rules.
[/code]
Reply With Quote
  #5  
Old 12-03-2005, 03:31 PM
xinn xinn is offline
Member
 
Join Date: Aug 2005
Posts: 21
Hello,

thank you for your answer Goerge,

the rules which you wrote almost fits my needs, there is just small *bug*,
when you access www.sub.domain.pl it searchs for files in:
/home/user/public_html/www.sub not in /home/user/public_html/sub

This rule works perfect ( maybe someone other will use it in future - this is why i post it here ):

Quote:
RewriteCond %{SERVER_NAME} !^www\.domain\.pl$
RewriteCond %{SERVER_NAME} ^(www\.)?([a-z-]+)\.domain\.pl$
RewriteRule ^/(.*)$ /home/domainpl/public_html/%2/$1
Thank you for your help Mistwang,

Best Regards
xinn
Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Subdomains with Plesk Granny Smith Install/Configuration 8 06-28-2007 02:11 PM
Subdomains powerblast Install/Configuration 2 07-18-2006 09:47 AM


All times are GMT -7. The time now is 01:46 PM.



- Archive - Top
© Copyright 2003-2011 LiteSpeed Technologies, Inc. All rights reserved. Privacy Policy.