Customization
My setup is to have resources distributed across two or more sites that have similar structures but with different content. In the example ...
http: // localhost / site1 /
http: // localhost / site2 /
There are two types of rewriting: CMS content (basically, only the content displayed on the page) and special modules (for example, a program module for a blog), where I have software designed for more specific processing of content from a database.
So, the first rewrite rule for a blog ensures that the blog module handles blog requests ....
http: // localhost / site1 / blog / *
http: // localhost / site2 / blog / *
... using the blog module software located in ...
http: // localhost / blog /
The CMS rewrite rule is designed to handle non-specific module requests ...
http: // localhost / site1 / *
http: //localhost/site2/my_page.html *
... using the CMS rewriting software located in ...
http: //localhost/rewrite.php
Problem
Modifications to the blog module and CMS conflict. I tried to make an exception using the following rule. Here is my code ...
RewriteEngine on RewriteCond %{REQUEST_URI} !\.js$ RewriteRule .*/blog(.+) blog$1 [QSA] RewriteRule !.*/(admin|blog|forums)(.+)$ rewrite.php
The last rule does not actually work. With this code, if I get access.
http: // localhost / site1 / blog / *
http: // localhost / site2 / blog / *
... any blog (or admin or forum) URL for any site is still being rewritten to work with localhost / rewrite.php.
So, how do I configure the last rule to satisfy the following conditions, please ...
1.) The first directory (site1 or site2 in localhost / site1 / blog) remains dynamic, so I can add a third site if I want, without having to reconfigure the code for any reason in this regard.
2.) That the index of the blog (or administrator or forum) (for example, blog /, forums /, admin /) is processed by their own modules, as well as anything inside these directories (for example, admin / 1, admin / test.html) regardless of the HTTP code, 200, 404, etc.
3.) Any URL that is not in the exception list of the last rule is processed by the rewrite.php command (regardless of the HTTP code, 200, 404, etc.).
4.) localhost / site1 / blog / is not processed by rewrite.php, and localhost / site1 / random_path is not processed by rewriting the blog module.
I will be happy to respond promptly to any further clarifications.