Gossamer Forum
Home : General : Internet Technologies :

Mod_rewrite - handle a subdomain with .htaccess

Quote Reply
Mod_rewrite - handle a subdomain with .htaccess
I would like to use rewrite rule to handle a subdomain with .htaccess (setting document root for a subdomain). I have the wildcard set on my subdomains.
Domain is: mysite.com
Subdomain is: test.mysite.com

I try to use these rules, to handle the "test" subdomain with .htaccess:
Quote:
RewriteCond %{HTTP_HOST} ^test\.mysite\.com$ [NC]
RewriteCond %{REQUEST_URI} !^/htmlroot/testdir [NC]
RewriteRule ^(.*) /htmlroot/testdir/$1 [L]


Unfortunately the problem is, that typing the following URL:
http://test.mysite.com/aa
will cause to display
http://test.mysite.com/htmlroot/testdir/aa/
in the browser location.


Any idea how to fix the problem?

Best regards,
Webmaster33


Paid Support
from Webmaster33. Expert in Perl programming & Gossamer Threads applications. (click here for prices)
Webmaster33's products (upd.2004.09.26) | Private message | Contact me | Was my post helpful? Donate my help...
Quote Reply
Re: [webmaster33] Mod_rewrite - handle a subdomain with .htaccess In reply to
 
Try looking at http://forum.modrewrite.com/

Found there:

Code:
RewriteEngine on
RewriteCond %{HTTP_HOST} ^(.*)\.domain\.de$
RewriteCond %{HTTP_HOST} !^www\.domain\.de$
RewriteRule (.*) http://domain.de/%1$1 [P]

might work....

</not a clue>

Last edited by:

Dinky: Dec 16, 2005, 12:16 AM
Quote Reply
Re: [Dinky] Mod_rewrite - handle a subdomain with .htaccess In reply to
Your suggested solution does not change the html root of the subdomain.

However I think the suggested URL will be helpful.

Best regards,
Webmaster33


Paid Support
from Webmaster33. Expert in Perl programming & Gossamer Threads applications. (click here for prices)
Webmaster33's products (upd.2004.09.26) | Private message | Contact me | Was my post helpful? Donate my help...