Hi,
I'm an htaccess newbie....trying to set up my webspace with multiple domains properly. There are several considerations that I'm trying to take into account at once, and as a result, things aren't set up properly. Just wondering if someone can help?
Here's the picture so far:
I have a webspace with one "default" domain that was set up when I purchased the webspace, called "infinitives.ca"; plus there's a few other "addon" domains I set up afterward. I'll number those addon domains "domain1", "domain2", etc. (their actual names aren't important to this story, I don't think.)
To clean up my /public_html folder, I decided to set things up so that each domain--the default one and the addon ones--is in its own separate folder inside public_html, like this:
/public_html
|
|----> infinitives.ca
|----> domain1.ca
|----> domain2.ca
That way, I can neatly work with each website in its own dedicated folder, can run external installation scripts for web applications (which require public_html permissions to function properly), etc. Neat, eh?
Since requests to infinitives.ca, by default, would go to /public_html first, and then not find an index file, I set up an htaccess file inside /public_html to direct those requests to the infinitives.ca subfolder. That works perfectly. I also have it set up to remove any "www." at the beginning of URLs....I want that to be in effect for ANY URL visitors go to on my sites. I hate the "www."
Next, I have a subfolder inside infinitives.ca called "RKE", which is basically a separate website in its own right from the rest of infinitives.ca (it's a site for the band I'm in...nothing to do with infinitives.ca, which is my business site, but I needed to put RKE's website somewhere, and I had the webspace, so...*shrug*). I want requests to "infinitives.ca/rke" to get rewritten as "infinitives.ca/RKE", because RKE is an acronym, and it looks silly in lowercase. In addition, since the default index file in RKE is "default.php", I need a DirectoryIndex call that lets the server know that.
The last paragraph is the part I'm having the problem with. I have no idea where the htaccess to handle those two things goes, or how to phrase it properly, or how to remove the "www." there as well, or how to prevent everything from conflicting with the htaccess file in /public_html. I've tried putting an htaccess file in /public_html/infinitives.ca, and also an htaccess file in /public_html/infinitives.ca/RKE, but no luck. In fact, I seem to have screwed things up a bit.
Right now, if you go to infinitives.ca/RKE/ (note the last slash), it's fine. But if you go to infinitives.ca/RKE (without the last slash), the URL gets written as "http://infinitives.ca/infinitives.ca/RKE/" . That's probably because the FIRST htaccess file, the one that was supposed to sort out the domains in /public_html, is not configured right. And of course, as you can see, infinitives.ca/rke doesn't get rewritten to infinitives.ca/RKE; in fact, it returns a 404 error, because there is no such directory as "rke" (case sensitive).
*deep breath*.....so.....HELP! lol Can someone help make sense of all this?
If it helps, here's what the htaccess file in /public_html has right now:
RewriteEngine On
Options +FollowSymlinks
RewriteBase /
RewriteCond %{HTTP_HOST} infinitives.ca
RewriteCond %{REQUEST_URI} !infinitives.ca/
RewriteRule ^(.*)$ infinitives.ca/$1 [L]
There's also an htaccess file in the /public_html/infinitives.ca folder, which has this:
# mod_rewrite in use
Options +FollowSymLinks
RewriteEngine on
RewriteCond %{HTTP_HOST} .
RewriteCond %{HTTP_HOST} !^infinitives\.ca
RewriteRule (.*) http://infinitives.ca/$1 [R=301, L]
And, last but not least, in /public_html/infinitives.ca/RKE folder, there's this htaccess file:
DirectoryIndex default.php
What a mess