Special character - '%' rewrite

Hey

I have news items that the title is passed to pull down a record from the db

All has been fine, until i added ‘20% discount’ as one of the titles and all fails…

I had a quick look around, however i couldn’t find a definite answer…so, is it possible to add something like (this fails by the way!):

rewriteRule ^news/([A-Z0-9-&'+[^%]!?\(\)\ ]+)$ /news.php?name=$1 [NC,L]

or, is it too much trouble, and therefore its better to rename the title without the use of the ‘%’

thanks in advance

As far as I know you can’t use % character stand-alone in an URL, because they are used to create URL encoded characters. For example %40 in an URL stands for the @ character.

If I were you I’d change the % to “percentage” in the URL.

BTW. Looking at the regular expression you have now, why would you allow spaces in your URLs? Spaces would normally be %20 in an URL, and that just looks bad. Trying to include spaces in your URL is asking for trouble IMHO.

barney,

ScallioXTX,

The space within a character range definition is the way to match %20 in the URL string. The character range definition is where most characters do NOT get escaped but the space and, presumably, % are exceptions.

Regards,

DK