Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

I have looked at all sorts of solutions online and come up with nothing. I cannot ask the webhost for help because it's not my hosting account; I am setting it up for a client. My client has a domain name through some domain registrar, and web hosting through iPower. For sake of example, let's say their domain name is domain.com. I want to point sub.domain.com to domain.com/sub in a transparent way (so that a visitor would type sub.domain.com and their address bar would continue to show that as the domain, never visibly switching to domain.com/sub).

Tools I do not have:

  • access to httpd.conf
  • SSH access to the hosting server
  • the ability to contact iPower support, since I don't have clearance to access the information (billing and security question) they require of me when submitting a support ticket

Tools I do have:

  • indirect access to the domain registrar's control panel (I send the admin an email and he changes it according to my wishes, but he is not knowledgeable about networking or DNS or anything)
  • access to iPower hosting control panel
  • access to .htaccess files
  • FTP access to the iPower public_html directory and all subdirectories

The domain registrar's control panel offers the usual ability to set CNAMEs, MX records, A records, etc. The iPower hosting control panel has a sort of "ghost" of the domain in their domain control panel as well, and though it tells me the domain is registered elsewhere, it allows me to input things like DNS records and subdomains.

So far, I have the domain set up on the registrar with an A record pointing to the server's IP address. I tried setting up a similar A record on the iPower end of things, to no avail. Same with a Subdomain, and a CNAME. It only ever sends requests to sub.domain.com directly to the files in the public_html folder (the same as what's displayed at domain.com. I tried the mod_rewrite rule presented HERE, but it seemed to have no effect. I also tried the mod_rewrite rule presented HERE, but it brought me a 500 Server Error when I tried it (I'm sure I modified it incorrectly, but I don't know what I got wrong). When I had a corresponding A record and subdomain configured in the iPower domain control panel, instead of directing visitors to the root site, it displays a page that says "Directory has no index file. Browsing this site or directory without an index file is prohibited." even though there is an index file in that folder. There are a lot of files in that folder (Drupal installation), and accessing domain.com/sub directly produces the working website.

So. All that said, does anyone have any straightforward directions for me to follow? Please remember that I only have access to the .htaccess files and the domain control panels, but lack access to the Apache .conf files, so I can't do anything like ServerAlias.

I know this shouldn't be this complicated, but nothing I've tried from any of the directions or articles I've found which are applicable to my situation have helped.

I am mildly embarrassed to be having this problem, since I have had my own web hosting with multiple domains and subdomains for several years -- but I've been spoiled by the cPanel way of doing things, and having my domains and files hosted and managed in the same place. I can write code in a few different languages, and I can fix broken computers and other technology, but I can't figure out how to configure a webserver. Frustration.

Thank you in advance for your help and advice. I often find the answers I need just by searching and lurking here and there on this network of Q&A sites, but in this case, I have apparently been missing something.

share|improve this question
    
"How do I replace the engine of my car when all I have is a screwdriver, a roll of twine, and a feather duster?" :) –  EEAA May 10 '12 at 5:15
    
So you're saying I can't do this without access to the .conf file? Or are you just being cheeky? :) –  Adrian May 10 '12 at 5:30
    
Mostly cheeky. :) It's a tough nut to crack, though. Unfortunately I've been up for far too many hours to fully grok your situation. I'll take another look tomorrow, though, unless someone else gives an answer. –  EEAA May 10 '12 at 5:34
add comment

1 Answer

up vote 1 down vote accepted

1) just a note. You can't set up sub.domain.com without registrar's help, unless domain.com is running your own DNS server. I understand, however, that it is already done.

2) things that must be in the existing Apache httpd.conf, or you are out of luck:

a) RewriteEngine enabled. b) Apache accepting requests for sub.domain.com

If both those things are OK, then I suppose you should be able to do rewrite via .htaccess like this:

RewriteEngine On

RewriteCond %{HTTP_HOST}  domain.com [NC]
RewriteCond %{HTTP_HOST}  !^$
RewriteRule ^/sub(.*) http://sub.domain.com/$1 [R=301,L]

Details may vary depending on what your underlying web pages have configured for site URL and whether you want to use single sub.domain or more, etc.

share|improve this answer
    
Ok, I finally got some time to test your mod_rewrite code. It still just loads the main page in the root folder (public_html). Does that mean RewriteEngine is disabled, since it seems to have no effect? –  Adrian May 11 '12 at 3:03
    
Yes, that would seem to indicate this. –  Gnudiff May 11 '12 at 20:32
    
Awesome. (sarcasm) Thanks. (genuine) I thought maybe my issue was just not covered in anything else I read, and I had really hoped it wasn't some kind of restriction with their webhost, but I guess my hopes have been dashed. I can't believe they pay more for their hosting than I do for mine, and they get fewer features and an unusable knowledgebase for their trouble. Oh well...time for Plan B: Operation "Just Suck It Up." –  Adrian May 12 '12 at 0:13
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.