php - mod_rewrite is behaving strangely - some RewriteRules work and others don't

528

I have a list of about 40 RewriteRules, all pointing to the same page, but with a different query string.

Most (37) of the rewrites work properly. Here are examples:

RewriteRule ^absa/?$ /register.php?company=absa [NC,L]
RewriteRule ^crc/?$  /register.php?company=crc [NC,L]

But 3 of them don't work at all and throw a server error. They aren't any different, as far as I can tell.

RewriteRule ^bv/?$  /register.php?company=bv [NC,L]

I've tried restarting Apache, I've visitedregister.php?company=bv and it works just fine, and I'm all out of ideas.

Anyone know what might be going on?

Thanks.

392

Answer

Solution:

Not an answer (since you haven't provided all the details like error.log) but you can reduce your total # of rules dramatically like this:

RewriteRule ^(crc|absa|bv|ge|qafco)/?$  /register.php?company=$1 [NC,L]

People are also looking for solutions to the problem: PHP reduce function calls by optimizer

Source

Didn't find the answer?

Our community is visited by hundreds of web development professionals every day. Ask your question and get a quick answer for free.

Ask a Question

Write quick answer

Do you know the answer to this question? Write a quick response to it. With your help, we will make our community stronger.

Similar questions

Find the answer in similar questions on our website.