View Single Post
Old 11-03-2002   #1
SmutNames
Members
 
Join Date: Oct 2002
Posts: 13
Default

Hey Guys,

Im trying to get modrewrite to automatically redirect domain names based on the name without having to do any setting up in the httpd.conf.

What i mean i have domain1.com

By default when that hits the server it should go to /www/hosts/domain1.com without having to setup anything specific for that domain.

Now ive got it mostly sorted out... and it works.. if somebody types in www.domain1.com or http://www.domain1.com or even http://www.domain1.com/bullshit/8768768.htspujy

But i can't get it to work with just http://domain1.com

Heres a copy of the modrewrite code i have at the moment.. if anybody knows much about modrewrite i would LOVE if you could help me with this

RewriteEngine On

# a ServerName derived from a Host: header may be any case at all
RewriteMap lowercase int:tolower

## deal with normal documents first:
# allow Alias /icons/ to work - repeat for other aliases
RewriteCond %{REQUEST_URI} !^/icons/
# allow CGIs to work
RewriteCond %{REQUEST_URI} !^/cgi-bin/

# do the magic
RewriteCond ${lowercase:%{SERVER_NAME}} ^.*\.[a-z-]+\.com$
RewriteRule ^(.+) ${lowercase:%{SERVER_NAME}}$1 [C]
# now create the real file name
RewriteRule ^.*\.([a-z-]+\.com)(.*) /www/hosts/$1/$2

## and now deal with CGIs - we have to force a MIME type
RewriteCond %{REQUEST_URI} ^/cgi-bin/
RewriteRule ^(.+) ${lowercase:%{SERVER_NAME}}$1 [C]
RewriteRule ^.*\.([a-z-]+\.com)(.*) /www/hosts/$1/$2 [T=application/x-httpd-cgi]
__________________
Plenty of domain names, if ya need any message me :)
SmutNames is offline   Reply With Quote