Hello my rewrite rule is failling sometimes because my web addresses have % signs inside them.

For instance this url:

http://www.chillisource.co.uk/product/Grocery/Dr.%20Burnoriums%20Psycho%20Juice/1/B005MSE5KG/Psycho_Juice_70%_Ghost_Pepper

This really is my rewrite rule:

RewriteRule ^product/([a-zA-Z]+)/([\sa-zA-Z0-9\-\+\.]+)/([0-9]+)/([A-Z0-9]+)/([a-zA-Z0-9]+) /product?&cat=$1&q=$2&page=$3&prod=$4&prodName=$5

How do i customize the fifth rule ([a-zA-Z0-9]+) not to fail on when there's a % within the product title ?

Thanks ahead of time.

Possibly, it isn't %20, but space. That's, the URL passed to rewrite adter urldecoding. Otherwise, then just add percent sign towards the range. (if so — space).

I suppose you've attempted "([a-zA-Z0-9%]+)"?

---- Forget this part, I misinterpreted the question ----

From things i achieve with a home mod_rewrite documentation (http://httpd.apache.org/paperwork/current/mod/mod_rewrite.html), you shouldn't suffer from hex encoded figures (I suppose that in the following statement:

THE_REQUEST The entire HTTP request line sent through the browser towards the server (e.g., "GET /index.html HTTP/1.1"). This doesn't include any extra headers sent through the browser. This value is not unescaped (decoded), unlike other variables below.

Actually, using mod_rewrite could be difficult since you'd suffer from that EVERYWHERE, e.g., you could write %41 rather than 'A'.

--- However the following is still true ---

However your rewrite rule can't work, a minimum of avoid the request URL you published: The final area of the regex "([a-zA-Z0-9]+)" is FAR too strict. Within this situation, it fails for an additional reasons:

  • It lacks cure from the percent sign, as with "70%"
  • You didn't remember to incorporate the underscore "_"

Try adding a minimum of both of these figures ("[a-zA-Z0-9%_]+") also it should work.