Dave,
No problem! That’s what I’m here for (to help others learn).
Do you have access to httpd.conf (actually, the httpd-vhosts.conf for your domain)? If so, move all the Redirects that work there so they’re only read once (rather than for EVERY @#$% file request!).
How is RedirectMatch 301 /hollis /hollis-farms/ supposed to tell hollis{followed by anything} from hollis-farms? Admittedly, I see your mod_alias directive with my mod_rewrite (regex) blinders on but it looks like it should be loopy!
:tup: “Firefox has detected that the server is redirecting the request for this address in a way that will never complete.”
That’s what I’d expect.
Since you have that for (all?) your RedirectMatch statements, I’m shocked that your Apache hasn’t packed up its teepee and headed for the Great Plains!
It dawned on me after testing that the old folder (hollis) is the first word in the new folder and every one that is like that throws the same error. The ones (like the working one above) had a goofy folder name like pipecreek or dht, or hht) … that first word in the new folder name no longer exists so the new rewrite condition and rule you posted works as expected.
Okay, you found that problem, too!
Next, do you really expect rrreoirthwerhiew NOT to be matched by
RewriteEngine on
Options +FollowSymlinks
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
# prevent this causing a loop
RewriteCond %{REQUEST_URI} !^sites/
RewriteRule [COLOR="Red"].?[/COLOR] sites%{REQUEST_URI} [L]
# If the URI doesn't end with .js and .jpeg and .jpg and .gif and .css or any others
RewriteCond %{REQUEST_URI} !\\.(js|jpe?g|gif|css|swf|html|jsp|ico|png|xml|xsl|rdf|txt|gz|php|shtml|pdf|zip|htm)$ [NC]
# apply transformations
RewriteRule ^[COLOR="Red"]([^/]+)[/COLOR]$ index.php?pageName=$1 [L]
Note that BOTH red bits WILL match rrreoirthwerhiew with the sites/rrreoirthwerhiew taking precedence (order) at which time
RewriteCond %{REQUEST_URI} !\\.(js|jpe?g|gif|css|swf|html|jsp|ico|png|xml|xsl|rdf|txt|gz|php|pdf|zip|htm)$ [NC]
RewriteRule ^([^/]+)/([^/]+)$ index.php?pageName=$1&id=$2 [L]
will kick-in and redirect to index.php with sites as the pageName value and id=rrreoirthwerhiew! If index.php can’t handle that jibberish, you’re in real trouble!
Does that mean you’ve fixed it the way you need?
IMHO, you need to “trim” your .htaccess to something more reasonable else you’ll be burdening your server far too much with every file request.
Then think like mod_rewrite and “see” how each request is handled - remembering to follow the redirections through the next loop (mod_rewrite keeps looping back through until no more redirections are found/executed).
What you’ve encountered is similar to the problem that noobies have when they use (.*) to match (NOTHING or EVERYTHING) and wonder why their redirections never end (go loopy). If you’re as exact as possible in defining the {REQUEST_URI} string which you need to be redirected, that tends to avoid the loop problem.
Regards,
DK