0

I am working in a shared account on a hosting provider with several domain names. Goal is to have each domain name have their own virtual directories. In my personal configured htdocs/ directory, I have a subdirectory set up for each domain name, something quite similar to this:

htdocs/
    foo.com/
        index.html
    bar.com/
        test.txt

I'd like to serve http://foo.com/index.html instead of http://foo.com/foo.com/index.html.

Is this the proper way to set up .htaccess in htdocs/?

RewriteEngine on
RewriteCond %{HTTP_HOST} .*foo\.com [NC]
RewriteRule ^/(.*)$ /foo.com/$1 [L]

I assume no as this does not appear to be working and I'm not granted access to error logs. What is the proper syntax?

Jé Queue
  • 10,359
  • 13
  • 53
  • 61

1 Answers1

1

You shouldn't have to set up .htaccess rules for different domains like that if your on a shared account. Most hosting providers allow you the capability to set up add-on domains, which sets up the proper mappings for you.

jaywon
  • 8,164
  • 10
  • 39
  • 47
  • Correct, but this one in particular does NOT have that setup. – Jé Queue Dec 09 '09 at 05:39
  • 1
    What a ghetto host. Change to a different one –  Dec 09 '09 at 05:40
  • are you allowed to host multiple domains with your hosting plan? – jaywon Dec 09 '09 at 05:46
  • Yes, but this isn't my personal or business hosting, this is a customer's of mine. – Jé Queue Dec 09 '09 at 05:53
  • Then you are advising your customer, tell him to switch providers. – Don Dec 09 '09 at 06:14
  • Gotcha, but any thoughts as to solve this from mod_rewrite in the interim? – Jé Queue Dec 09 '09 at 06:15
  • It sounds like you have a bit of a unique situation in the way your hosting provider has their setup. You may want to contact them. This is a pretty standard procedure, so they should be able to advise on how they recommend you doing it. – jaywon Dec 09 '09 at 06:46
  • @jaywon. I tried that too :) but there is a price associated with it, they want to charge double (which isn't much but it is annoying). We are definitely going to be moving providers. Still curious if what is listed above or some other rules would work? – Jé Queue Dec 09 '09 at 15:47