thisisvlad Posted January 14, 2006 Posted January 14, 2006 is it possible to set up an .htaccess file to have my subdomain point to my regular domain? in other words, when someone goes to sub.domain.com/file.html it will show them www.domain.com/file.html. i DO NOT want to use the cpanel redirect, as this will actually replace the url in the browser url bar. i want the user to still see sub.domain.com in his browser url bar. Quote
TCH-Andy Posted January 14, 2006 Posted January 14, 2006 Are you just hosting the sub.domain.com with us? Can I ask for a bit more background (you can always PM me if you prefer not to post some of the details) so that we can offer the best solution. Quote
rick02840 Posted November 22, 2006 Posted November 22, 2006 I want to do this exact same thing. I have a simple reseller account. I want all of these to point to root (www): www.domain.com www.sub1.domain.com www.sub2.domain.com www.sub3.domain.com etc... If you are wondering why, I am using Drupal and it can do multiple sites (with the same Drupal install) in the same WWW by reading the URL and pulling in a different settings file. Thanks, Richard Hood Quote
TCH-Andy Posted November 22, 2006 Posted November 22, 2006 To do a basic redirect you would use >RewriteEngine on RewriteBase / RewriteCond %{HTTP_HOST} !^www\.domain\.com$ [NC] RewriteRule ^(.*) http://www.domain.com/$1 [L] which would redirect all the subdomains to the main domain. What part does Drupal want to read though? Does it need the subdomain name somewhere in the URL (such as domain.com/sub) ? Quote
rick02840 Posted November 22, 2006 Posted November 22, 2006 Thanks Andy, Drupal reads the domain of the URL, but not folders: www.domain.com, sub1.domain.com, sub2.domain.com, sub3.domain.com, etc. NOT www.domain.com/folder. What I am wanting to do is have all subdomains of a certain domain pointing to the same place: public_html (public_html/index.php) I guess this is really parking of the subdomain(s) onto the domain. When you create a subdomain in CPanel, it creates a folder under the domain and points the subdomain to that folder. Normally, that is fine, but in this case that is not what I want to do. I am not sure redirect is the best way to do that. Does that leave the URL intact (e.g. does redirect of ‘sub1.domain.com’ to ‘domain.com’ leave ‘sub1.domain.com’ as the URL? ). Also, to redirect for every single page request sounds like extra overhead – or is that not a big deal? Any ideas? Thanks, Rick Quote
TCH-Andy Posted November 22, 2006 Posted November 22, 2006 Hi Rick, I had a quick look at Drupal, and it seems that most ways would conflict with the way Drupal works. The method they recommend it to use a symlink (but unfortunately you need shell access for that which you don't have - we could do it from the help desk for you though). One method that people report as working is, instead of setting up subdomains, simply park the subdomain on top of your domain in WHM (as you suggest). Then the URL etc remains, and all goes to the same main account (where Drupal interprets it to provide the correct info). Quote
rick02840 Posted November 22, 2006 Posted November 22, 2006 One method that people report as working is, instead of setting up subdomains, simply park the subdomain on top of your domain in WHM (as you suggest). Then the URL etc remains, and all goes to the same main account (where Drupal interprets it to provide the correct info). Perfect! I should have seen that myself in WHM but did not notice the "Park a domain" link and the whole DNS functions section. Thanks, Rick Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.