My problem is this, I have issues with similar looking rules in my urewrite.xml file, in the fact that the first rule will work, but similar rules that follow will not. Here is an example:
<rule>
<from>Porsche-911_991-3.4_Carrera.jsp</from>
<to>cars.jsp?makeID=640&modelID=3747</to>
</rule>
<rule>
<from>Test-Porsche-911_991-3.4_Carrera.jsp</from>
<to>test.jsp?makeID=640&modelID=3747</to>
</rule>
The first rule works, the second does not, the reason for which escapes me. If I manually visit test.jsp?makeID=640&modelID=3747 the page works, if I try Test-Porsche-911_991-3.4_Carrera.jsp the page does not appear, simply generates an error log specifying parameters are missing.
I hope somebody can assist me before I pull all my hair out.
The matching text of the first rule, Porsche-911_991-3.4_Carrera.jsp
, is a substring of the matching text of the second rule. As a result, the second URL is gone.
Use the caret metacharacter to distinguish between the two URLs:
<rule>
<from>^/Porsche-911_991-3.4_Carrera.jsp</from>
<to>cars.jsp?makeID=640&modelID=3747</to>
</rule>
<rule>
<from>^/Test-Porsche-911_991-3.4_Carrera.jsp</from>
<to>test.jsp?makeID=640&modelID=3747</to>
</rule>
Reversing the order to put the more specific URL first would work as well:
<rule>
<from>Test-Porsche-911_991-3.4_Carrera.jsp</from>
<to>test.jsp?makeID=640&modelID=3747</to>
</rule>
<rule>
<from>Porsche-911_991-3.4_Carrera.jsp</from>
<to>cars.jsp?makeID=640&modelID=3747</to>
</rule>