Page is a not externally linkable
lucy24 - 8:14 am on Jan 21, 2013 (gmt 0)
When you talk about Mac and Windows do you mean live servers (very, very small ones I assume) or MAMP vs. WAMP? I'd think it far more likely to be in Apache itself. After all, something has to have changed to make them bump the number from ..4 to ..22
:: poring over sample code ::
RewriteCond %{THE_REQUEST} \?
RewriteCond %{QUERY_STRING} ^mode=create&usertype=pri$
RewriteRule ^register\.php$ /manufacturers-sales-reps-register.php? [NC,L,R=301]]
RewriteRule ^manufacturers-sales-reps-register\.php /register.php/?mode=create&usertype=pri [L,NC]
Hm, let's buy time by looking at the other issues.
Rule 1 has two conditions; Rule 2 has none. But there's no need for two separate conditions. You're saying
#1 the query string has to be part of the original user request (literal ? in THE_REQUEST) and
#2 the query string has to consist of such-and-such literal text, with nothing before and nothing after. It can be easily collapsed into
RewriteCond %{THE_REQUEST} [A-Z]{3,9}\ /register\.php\?mode=create&usertype=pri\ HTTP
where [A-Z]{3,9} is probably overkill for GET or whatever single method you're dealing with. You'd only need to separate the "request" and "query string" conditions if the query string might include other pieces, or its elements might come in a different order.
If g1 were here, he would point out that as long as you're making short pretty URLs --for, ahem, a given definition of "short"-- you don't need that final .php at all.
In a redirect, always include the full protocol-plus-domain. This is where you standardize things like with-or-without www., and make sure there aren't any stray port references sneaking around.
Conversely: In a rewrite, never ever use the [NC] flag. It is fine-- though not essential-- in redirects, but here you're just begging for Duplicate Content.
RewriteRule ^register\.php$ /manufacturers-sales-reps-register.php? [NC,L,R=301]]
RewriteRule ^manufacturers-sales-reps-register\.php /register.php/?mode=create&usertype=pri [L,NC]
The target of the first rule should be identical to the pattern of the second rule, and vice versa. (The "vice versa" is not true in all situations, but it is here.) Except of course the protocol-plus-domain part; that's only for redirects. Here you've got an extra / after the "php" in the rewrite version. Your server is probably going bonkers looking for that final directory.
And speaking of extras, I hope the final bracket in [NC,L,R=301]] is a typo. Otherwise I'd expect a whole new set of 500-class errors.
Now then:
the identical redirect code leads to an infinite loop on a Windows instance
When you say "infinite loop" do you mean external or internal? If it's internal, the error message comes from the server and the problem is with a rewrite. If it's external, the error message comes from the browser and the problem is with a redirect.
Oh yes and... Can I assume all of this is happening in htaccess? Otherwise you need a leading directory-slash in each pattern. I also have to assume there is more than these two rules in the htaccess, even if you're only looking at the mod_rewrite part. At a minimum, there would have to be a "RewriteEngine on" directive. Have you eliminated all other redirects and rewrites as possible troublemakers? Does anything in either setup use mod_alias along with mod_rewrite?