[thelist] Mod Rewrite

Jackson Yee jyee at vt.edu
Fri Aug 22 09:01:49 CDT 2003

I haven't seen RewriteRule used to match domain names rather than path 
information before, so that might be what your issue is.


RewriteEngine on
RewriteBase /

RewriteCond %{HTTP_HOST} ^www\.domain\.com$
RewriteCond %{REQUEST_URI} !.*mainsite.*
RewriteRule (.*) /mainsite/$1 [R]

RewriteCond %{HTTP_HOST} ^domain\.com$ 
RewriteCond %{REQUEST_URI} !.*mainsite.*
RewriteRule (.*) /mainsite/$1 [R]

You can also use the RewriteLog and RewriteLogLevel directives to get a better 
idea of what is happening as you make each request.

Jackson Yee
jacksonyee at vt.edu

>===== Original Message From RLivsey <R.Livsey at cache-22.co.uk> =====
>www.domain.com/123/456 -> www.domain.com/mainsite/123/456
>domain.com/123/456 -> domain.com/mainsite/123/456
>This is what I have got to so far:
>#--- start .htaccess ---#
>RewriteEngine on
>RewriteCond %{HTTP_HOST} ^www\.domain\.com$
>RewriteRule ^www\.domain\.com/(.*) /mainsite/$1
>RewriteCond %{HTTP_HOST} ^domain\.com$
>RewriteRule ^domain\.com/(.*) /mainsite/$1
>#--- end .htaccess ---#

More information about the thelist mailing list