Forum Moderators: phranque
I've just upgraded to Apache2 and have hence had to update all of my rewrite rules.
For some reason the "&" symbol within the destination string is causing issues.
The system is copying part of the original short URL into the destination URL instead of remaining as an "&" symbol hence:
RedirectMatch 301 /entries/([0-9-]+)$ http://www.example.com/?action=view&entryid=$1
When forwards becomes:
http://www.example.com/?action=view/entries/3450entryid=3450
I need a way of keeping "&" as "&" instead of becoming "/entries/3450"
Any help with this would be greatly appreciated,
Rich
[edited by: jdMorgan at 12:37 pm (utc) on May 23, 2009]
[edit reason] example.com [/edit]
Looking at the mod_alias documentation, one will find:
mod_alias is designed to handle simple URL manipulation tasks. For more complicated tasks such as manipulating the query string, use the tools provided by mod_rewrite.
However, I'd say you may have found an actual bug here, and you may wish to investigate the bug reports at Apache.org.
The form of your code brings up another question, though: Why do you wish to use a redirect and 'expose' the long, ugly, complex query-string URL to the client with a redirect instead of using the nice, short, original URL? I'd comment that instead of using an external client redirect here, an internal rewrite would seem to be more appropriate.
Unlike an external redirect, an internal rewrite would NOT tell the search engines to replace your short/pretty URL with the long one...
Jim
Found the solution here:
the "&" requires a "\" before it in order to get it working thus:
"\&"
All good.
Cheers for the mod_alias pointer - steered me in the right direction,
Rich