Welcome to WebmasterWorld Guest from 54.196.232.162

Forum Moderators: Ocean10000 & incrediBILL & phranque

Message Too Old, No Replies

"&" Symbol Causing Mod Rewrite Errors

apache2 mod_rewrite errors using "&" symbol

     
12:03 pm on May 23, 2009 (gmt 0)

New User

5+ Year Member

joined:May 23, 2009
posts: 3
votes: 0


Hey All

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]

12:38 pm on May 23, 2009 (gmt 0)

Senior Member

WebmasterWorld Senior Member jdmorgan is a WebmasterWorld Top Contributor of All Time 10+ Year Member

joined:Mar 31, 2002
posts:25430
votes: 0


This is not mod_rewrite code. RedirectMatch is a mod_alias directive.

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

1:08 pm on May 23, 2009 (gmt 0)

New User

5+ Year Member

joined:May 23, 2009
posts:3
votes: 0


Cheers Jim,

Found the solution here:

[publib.boulder.ibm.com...]

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

6:40 pm on May 23, 2009 (gmt 0)

Senior Member

WebmasterWorld Senior Member g1smd is a WebmasterWorld Top Contributor of All Time 10+ Year Member Top Contributors Of The Month

joined:July 3, 2002
posts:18903
votes: 0


By why redirect to the ugly URL at all?

Surely you need a rewrite instead?

 

Join The Conversation

Moderators and Top Contributors

Hot Threads This Week

Featured Threads

Free SEO Tools

Hire Expert Members