Go Back   cPanel Forums > General Discussion > cPanel Newbies

Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 07-06-2009, 06:21 AM
Registered User
 
Join Date: Jul 2009
Posts: 6
peter.moore is on a distinguished road
Redirecting a second subdomain to Google Apps using cPanel

Since cPanel doesn't allow me to create CNAME records, I created a sub-domain in cPanel (called info.mydomain.com) and then redirected it to the full Google Apps url(ie http://mail.google.com/a/yourdomain.com). It works fine when I type: info.mydomain.com as a url and directs me to Google Apps login.
However, when I create a second subdomain called 'query.mydomain.com' and again redirect it to the full Google Apps url metioned above, I get the following error when I enter 'query.mydomain.com' as a url:

"Server error.
Sorry, you've reached a login page for a domain that isn't using Google Apps. Please check the web address and try again".
I earlier logged in Google Apps as 'info' and created query@mydomain.com and I've also checked subdomain settings in cPanel ....all seems ok...any ideas. Thanks.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #2 (permalink)  
Old 07-06-2009, 06:56 AM
Senior Member
 
Join Date: Jun 2005
Location: Area 51
Posts: 1,535
Spiral is on a distinguished road
Wink

Are you an end user or a server administrator?

If you have access, just simply edit the DNS zone on the server and add
in whatever CNAME records you wish and restart your "named" service.

Code:
# cd /var/named
# vi whateverdomain.com.db
  (NOTE: some might use pico instead, I prefer vi)

/\/\/\/  Make whatever zone file changes you wish \/\/\/\/\/

# service named restart
If you want to get fancy, you can edit the zone templates in WHM to add either a wildcard (*) DNS entry
or automatically setup the specific subdomain for every domain on the server on all accounts you create
and then create a new virtualhost with that address as a wildcard (subdomainname.*) for the server name
and then put in a redirect script or mod_rewrite in that new virtualhost. The end result is that every account
on your server will have a special subdomain under it's own domain that automatically redirects.

Back when Cpanel was a little crappier about keeping up with MySQLAdmin updates, we used to setup
our own updated version under http://mysql.*.* for all accounts using this same technique.

Quote:
However, when I create a second subdomain called 'query.mydomain.com' and again redirect it to the full Google Apps url metioned above, I get the following error when I enter 'query.mydomain.com' as a url:

"Server error.
Sorry, you've reached a login page for a domain that isn't using Google Apps. Please check the web address and try again".
I earlier logged in Google Apps as 'info' and created query@mydomain.com and I've also checked subdomain settings in cPanel ....all seems ok...any ideas. Thanks.
Assuming you didn't mess up something on either your Cpanel side or Google side, I would probably first look into
exactly how are you initiating your "redirect" because that could effect the referrer sent to Google which is what
Google uses to identify the source of the directed connection.
__________________
[b][color="Blue"]Server Support[/color]: [color="Red"]Server consulting, security, and management![/color][/b]

Last edited by Spiral; 07-06-2009 at 07:10 AM.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #3 (permalink)  
Old 07-06-2009, 08:21 PM
Registered User
 
Join Date: Jul 2009
Posts: 6
peter.moore is on a distinguished road
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.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #4 (permalink)  
Old 07-07-2009, 03:35 AM
Senior Member
 
Join Date: Jun 2005
Location: Area 51
Posts: 1,535
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
__________________
[b][color="Blue"]Server Support[/color]: [color="Red"]Server consulting, security, and management![/color][/b]

Last edited by Spiral; 07-07-2009 at 04:24 AM.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #5 (permalink)  
Old 07-07-2009, 06:07 AM
Registered User
 
Join Date: Jul 2009
Posts: 6
peter.moore is on a distinguished road
index script suggestion

Thanks for your reply.

My web host provider doesn't allow me to setup seperate
CNAME alias records under my domain for each subdomain, etc.

So that leaves your 'index script' suggestion.
I had setup a subdomian "info.domain.com" under my hosting account "domain.com", so that's already been done,
but I have one question.

Should I place the code snippet:
<?php
$mydomain = str_replace("www.", "", $_ENV['HTTP_HOST']);
header("Location: http://mail.google.com/a/{$mydomain}");
?>

into my index.html file, or create an new file called index.php and place that in the 'root' directory?
Thanks again for your time...much appreciated.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Adding Custome Features (Google Hosted Apps) bradandersen Themes and Branding 5 10-26-2008 10:40 PM
Using Google Apps. Cannot receive email clinch Mail 4 08-13-2008 05:49 AM
Using google apps sitekeeper Mail 5 01-18-2008 06:45 PM
Google Apps, Exim Replacement jandafields cPanel and WHM Discussions 2 12-29-2007 08:17 AM
Google Apps - gmail drhamad cPanel Newbies 1 02-13-2007 09:16 PM


All times are GMT -5. The time now is 07:14 AM.


Powered by vBulletin® Version 3.8.2
Copyright ©2000 - 2010, Jelsoft Enterprises Ltd.
© cPanel Inc