View Single Post
  #4 (permalink)  
Old 07-07-2009, 03:35 AM
Spiral's Avatar
Spiral Spiral is offline
Registered User
 
Join Date: Jun 2005
Location: Area 51
Posts: 1,501
Spiral is on a distinguished road
Exclamation

Quote:
Originally Posted by peter.moore View Post
Thank you, but here's what I want to do:


I have created 2 Google Apps user accounts: "info@mydomain.com" and "user@mydomain.com".

I can enter "info.mydomain.com" at the url address to get to the main Google Apps login page (where I login as 'info',etc).
I also want to be able to enter "user.mydomain.com" at the url to again get to the main Google Apps login page(to login as 'user' this time).
What change do I need to make in cPanel, if any?
(I am using cPanel provided by the domain web host provider).

Thanks again.
That is a little bit clearer ...

There are several ways to go about doing that. The cleanest would be
to set that up with a wildcard virtualhost but since it sounds like in
your last line above that you are an end user and not the server
administrator, scratch that option unless you can get your provider
to assist you (and most won't for that). You could setup seperate
CNAME alias records under your domain for each subdomain instead
of setting up actual subdomains on your hosting account but again
since you are not the server administrator or a reseller then that is
a limited option for you. The next best option that comes to mind
is to just setup a subdomain under your hosting account and then
put a redirect script in the subdomain that detects the subdomain
used to connect and construct a redirect to Google based on that .

(Using script redirection instead of mod_rewrites gives you a little bit
more flexibility in terms of any variables or other information you want
passed on to the redirect site and / or pre-processing before the redirect.
If you are currently using a flat mod_rewrite redirect with a fixed target,
that would explain why your second subdomain address doesn't work
)


If you want to be a bit fancier, you could have both "info" and "user"
subdomains call the same site and then have an index script there that
reads the "$_ENV["HTTP_HOST"]" variable and redirect with different
information depending on what URL (subdomain) the user used to reach
the redirect page that takes you on over to Google. That way the
same redirect information could pass different information or take
you to different web pages depending on whether someone typed
"info.domain.com" or "user.domain.com" or some other address even
though the subdomains themselves may actually all run the same script
but redirect differently depending on what address the user originally
used in their browser to call the redirect script page.

Just a simple example of what I'm talking about:
Code:
<?php
    $mydomain = str_replace("www.", "", $_ENV['HTTP_HOST']);
    header("Location: http://mail.google.com/a/{$mydomain}");
?>
Side note: HTTP_HOST is a variable that is set within the server
whenever you connect to a web site that tells all scripts running on
the web server what address the visitor used to connect to the site.
If Cpanel where checking that variable right now on my connection,
the variable would be set to "forums.cpanel.net" as that is the domain
address I used to connect to this forum community. Checking this
variable from scripts is an easy way to deliver different web content
based upon the domain or subdomain the visitor used to connect

Last edited by Spiral; 07-07-2009 at 04:24 AM.
Reply With Quote