|
|||
|
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. |
|
|||
|
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 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:
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. |
|
|||
|
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. |
|
|||
|
Quote:
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}");
?>
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. |
|
|||
|
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. |
![]() |
| Thread Tools | |
| Display Modes | |
|
|
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 | 4 | 08-13-2008 05:49 AM | |
| Using google apps | sitekeeper | 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 |