Forum Moderators: phranque

Message Too Old, No Replies

Redirect from subdomain to another subdomain silently.

         

petter78

10:16 am on Dec 31, 2006 (gmt 0)

10+ Year Member



Hi all,
I have this in my .htaccess which works:

RewriteEngine On
RewriteCond %{HTTP_HOST} ^.\.domain\.tld$
RewriteRule ^(.)/$ [webmail.domain.tld...] [P]

I use it for my webmail to autofill the form with username.

At first I tried to do it with a [R,L] which also worked, but not without an addresschange.
But now I would like to know if this is the only way, my problem is that I do not know if my host will keep on allowing me to use the proxy solution and besides that I am curios if this is the only solution.

In short am I looking for the best way to access webmail.domain.tld/?name=x with x.domain.tld continuing being the address in the bar.

Regards,
Peter

jdMorgan

5:10 pm on Dec 31, 2006 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



That's the only way I know of, although there are several ways to invoke the proxy.

Just curious, but the code you posted only allows single-character subdomains and user-names. Is this the actual code you're using, or did you just 'paraphrase' it?

Jim

petter78

10:40 pm on Jan 2, 2007 (gmt 0)

10+ Year Member



Ok, I guess the code is okay.

About the single character usernames, the code posted is what I use, I match the single letter with a username in the php file. The reason is mainly that I have other subdomains with multiple letters, but also due to convenience.