Page is a not externally linkable
lucy24 - 2:41 am on Jan 13, 2013 (gmt 0)
:: returning after Three Separate Attempts to ignore the question in hopes that someone else will answer it ::
The domain name you're groping for is example dot com. It's in, ahem, the Forum charter and also the Sticky at the top of the Apache forum list.
If I don't have a index file in one of the addon domains it redirects to the main domain. Is this normal behavior for the below htacces code?
Iffy wording there. Do you mean that you want it to do this and it doesn't, or that it's doing it and you want it to stop?
Are your add-ons completely different domain names or are they subdomains? (Got a vague idea "add-on" is a technical term used by some hosts but I, uhm, forgot what-if-anything it means.)
Assuming for the sake of discussion that #1 they're separate domain names, #2 the "add-ons" and your "main" domain all pass through the same htaccess, #3 there's no risk of overlap among domain names ...
Your code as given doesn't say anything about whether "index\.html?" exists-- either in reality or in potentia*-- or not.
First rule: Kicks in if request is sent to anything other than the list of named domains. I don't know-- and htaccess doesn't care-- whether this applies to one domain or hundreds. If the user's request ends in "index.htm(l)" then capture the directory name, if any, and redirect to the same named directory in one specific domain.
This is already confusing. Do all your domains have the same URL structure, so requests for
example-two.com/directory/index.html
www.example-six.com/directory/subdirectory/index.html
example-eight.com/directory/subdirectory/subsubdirectory/index.html
will be successfully redirected to
www.example.com/directory/
www.example.com/directory/subdirectory/
www.example.com/directory/subsubdirectory/
respectively?
Now, the second rule makes me suspect that you've got a finite number of add-ons and you're excluding all of them-- both here and in the preceding rule-- although the htaccess doesn't say so.
In the second case, it seems like it would be safer to say
RewriteCond %{HTTP_HOST} example\.com
RewriteCond %{HTTP_HOST} !^(www\.example\.com)?$
RewriteRule et cetera
and then you don't have to adjust the htaccess every time you add another domain. If the request is for anything other than example dot com, Condition 1 fails and the rule is ignored.
If Rule 1 is intended to do the same thing-- that is, it only applies to one specific domain-- use the same pair of conditions. But that's where we get into the confusion of wording. The # comment in the htaccess itself doesn't seem to say the same thing as your post. :(
* That is: if you've got auto-indexing enabled for a particular directory, the index file may not exist beforehand, but it's created and shown to the user as if it had been there all along. Except that a "real" index file probably wouldn't be an HTML 3 table ;)