Forum Moderators: phranque
However, you need to understand that mod_rewrite processing in .htaccess is recursive; If any rewrite or redirect is invoked, then the mod_rewrite rule processing is re-started from the top, in order to check for further rules that apply to the new URL-path -- for example for access control/security.
So in order to prevent recursion problems, you need to explicitly prevent some rules from being applied more than once within the context of the current HTTP request. This can be done based on the URL (which will have been updated), the query string (if it has been changed), or on other factors 'visible' to RewriteConds or RewriteRules.
As a last-ditch fix, you can create a user-variable using [E=var-name:var-value] and testing that variable using "RewriteCond %{ENV:var-name} !^var-value$" in order to prevent the following rule from being re-invoked.
Jim