Page is a not externally linkable
- Code, Content, and Presentation
-- Apache Web Server
---- Canonicalization: best code to redirect no-www to www & index to /


lucy24 - 6:16 am on Jan 13, 2013 (gmt 0)


Like it to NOT redirect to main/addon if there is no index file on the addon that is.

Well, that's the tricky bit. When you say "there is no index file" are you talking about physical files that either exist or don't exist? Your rule as written does something entirely different: It redirects any requests ending in "index.html" to the equivalent directory minus "index.html" -- but it also sends them all over to the main domain unless they're on the excluded list.

Now, you are about to hear a Voice of Dissent
:: twiddling thumbs and avoiding eye contact with g1 ::
but this is one of those situations where it's a ### of a lot easier if each domain has its own htaccess. Is this something your host won't let you do?

What's the physical directory structure? Are the add-ons in directories inside the first domain's directory, or are they all side by side in a single userspace? (The second way is the configuration that I'm used to. The first way is more common with subdomains.)

There's nothing in the existing code that would redirect to the primary domain when the request doesn't end in index.html.

Then again, I may be completely misunderstanding the question and your real problem is that the second rule kicks in when it wasn't supposed to. Or...

... or are both rules a red herring, and what's happening is that something that ought to serve a 403 or 404 in an add-on domain is instead sending people to the first domain?

How 'bout some real-life examples? You request A; you want or expect to end up at B; but instead you find yourself at C.

Note that B and C are each two different things: The content of the address bar and the content-- including title-- of the page. Since they are your sites, you know whether each of these pairs are matching up they way you want them to.

Edit: Oh, wait, I'm overlooking the obvious question. Why do you not want the add-ons to have index files? Where do humans end up if they request

www.example-two.com

and so on? Normally it would be the index page. Unless you're talking about domains that don't really exist at all; you're just using the names as aliases for the "real" domain. In which case you may be able to cop out, click some buttons and let the host handle it ;)


Thread source:: http://www.webmasterworld.com/apache/4508251.htm
Brought to you by WebmasterWorld: http://www.webmasterworld.com