I understand your code but believe that Domain.com’s DocumentRoot should be what you’ve labeled %{DocumentRoot}/apps/%{HTTP_HOST} so all your code should be skipped (not matched). If you’ve created your domain.com correctly, it should be to the (physical address of the) %{DocumentRoot}/apps/%{HTTP_HOST} directory.
But that’s only the first problem. These RewriteCond tests are ANDed so, to match both, the request must be to both a file and a directory!
Finally, the :kaioken: EVERYTHING :kaioken: atom you’ve used in the RewriteRule will match everything (and NOTHING) and will cause the block to loop.
You might benefit from reading the mod_rewrite tutorial linked in my signature as it contains explanations and sample code. It’s helped may members and should help you, too.
Nope, %{DocumentRoot} is /
There is my index.php too. I’ve did my framework to be able to handle multiple sites/domains in one instace. The /apps/%{HTTP_HOST} only holds controllers, views, and assets. Now my URL are look like this for example a CSS file: http://domain.com/apps/domain.com/assets/style.css but i want to make like this http://domain.com/assets/style.css
I’m can’t write rules for css/subfolders/images/etc. cuz i’m giving my clients/project members access the /apps/domain.com folder only where they can do anything they want. That’s why i want to have a universal code for these things.
I believe you’ve defined an impossible problem because:
The server’s root is the httpd’s root, too? :eek2:
You want to use domain.com for your .htaccess. Just how many "domain.com"s do you have? Is there a domain.com for every {HTTP_HOST} (there must be so your single use - across many clients - is impossible). Are you aware that domain.com IS the {HTTP_HOST}?
You only want to give access to apps/%{HTTP_HOST} to your {HTTP_HOST} client. Does this really mean that they don’t have access to domain.com’s root?
Apparently, assuming the above to be incorrect, you’ve apparently not tested the changes to your mod_rewrite code as recommended above - I’m not sure how to get out of the loop you’ve defined in the RewriteRule, though.
Think out of the box! Develop offline in a test server then upload the test to a subdirectory of the actual server for the client to check (assuming they can’t view your test server in action). With a test server, you can create all the virtual host domains you need (I do this and either drop the TLD or use an acronym for a domain) making testing as close as possible to the real server.
Yeah, i could use [OR] statement in one block instead of two for the first 2 but it was throwing 500, dont know why. But this solution is working just great.
No, %{DOCUMENT_ROOT} is not my server root, that was a misunderstanding by my fault. But it’s the root for my PHP Framework.
Ah, a specificity problem! Isn’t that always the way?
Okay, I’m glad that you’ve gotten it working for youself. I still don’t follow the use of %{HTTP_HOST} when domain.com is always your {HTTP_HOST} (and you’re looking to match domain.com, domain2.com and domain3.com. I fear that you’ll still have problems with this unless you specify your values for each place where you’re using %{HTTP_HOST}.
Hmmm, have you defined all three domains with the same ServerPath? If that’s the case, you may have found a way to beat the system!
As for your 500 errors, I’d guess that you used the [OR] flag after both RewriteCond statements (the second one is the error).
By definition, {DOCUMENT_ROOT} is the physical path to the DocumentRoot of a domain, in this case, your domain.com.
Back to your original question, though: I don’t believe that you can hide the URI … but the new information may have changed that - especially if the three domains are actually colocated - and you would do it exactly the way that you have the code now.