Forum Moderators: phranque
In an attempt to make subdomains work with Tomcat, I managed to get workers2.properties configured correctly, so that *.mydomain.com/docs is handled by Tomcat.
What I'd like to achieve with mod_rewrite is the following:
(1) www.domain.com --> www.domain.com/docs
(2) domain.com --> www.domain.com/docs
(3) <subdomain>.domain.com --> <subdomain>.domain.com/docs
I managed to get (3) to work and I was expecting (1) to work as well, but it doesn't.
(1) and (2) return a 400 Bad Request.
This is what I have:
# Rewrite <subdomain>.domain.be/ to <subdomain>.domain.be/docs
RewriteCond %{HTTP_HOST}!^w{3}\. [NC]
RewriteCond %{HTTP_HOST} ^([^.]+)\.domain\.com$ [NC]
RewriteRule ^/(.*)$ [%1.domain.com...] [R=permanent,L]
To make (1) work, I commented out the first RewriteCond, but no such luck...
Could you shed some light on this issue?
Thanks!
# Rewrite <subdomain>.example.com/ to <subdomain>.example.com/docs
RewriteCond %{HTTP_HOST} ^([^.]+)\.example\.com$ [NC]
RewriteRule ^/(.*)$ [%1.example.com...] [R=301,L]# Rewrite example.com/ to www.example.com/docs
RewriteCond %{HTTP_HOST} ^example\.com$ [NC]
RewriteRule ^/(.*)$ http://www.example.com/docs/$1 [R=301,L]
you may have to set and check an environment variable to prevent recursion...