Case 1: article/{whatever} => article/index.php?path={whatever}
Case 2: {not_article/} => index.php?path={not_article}
If you notice, both {whatever} and {not_article/} CONTAIN the redirection, too, so care must be taken to EXCLUDE the index.php in both instances. This would be easiest if I can assume that {whatever} and {not_article/} are ONLY lowercase letters (NO dot characters) so that’s what I’ll do rather than create a PROPER RewriteCond (please look to the examples in my signature’s tutorial Article for that).
RewriteCond $1 ^article(.*)$
RewriteRule ^article(.*)$ article/index.php?path=$1 [PT,L]
# Passthrough? :nono:
# Loops on /index.php
# Do you really want the / in the path value?
RewriteCond $1 !^article
RewriteRule ^(.*)$ public/index.php?path=$1 [L]
# loops on public/index.php
Okay, at noted above, the RewriteConds are incorrect (not to mention the first one’s flag).
What I would have used (with the simple assumption made above, i.e., that the variables you are using do NOT contain the dot character - add to that the / character for the public one):
RewriteEngine on
RewriteRule ^article/([^.]+)$ article/index.php?path=$1 [L]
RewriteRule ([^/.]+)$ public/index.php?path=$1 [L]
If you REALLY need the dot character in either/both and the / character in the public RewriteRule, then I’d use:
Normally, the RewriteCond must have a variable but you’ve taken care of that by using the atom from their RewriteRules (which is quite legal!) but checked that it NOT match the redirection in both cases (the article/ was NOT included in the first’s atom).
wow very much thanks for the great help dklynn! I have to try it out though it seems like my way of doing things over complicate stuff. Really your help!!!