Link to home
Start Free TrialLog in
Avatar of sharingsunshine
sharingsunshineFlag for United States of America

asked on

Rewrite URL With Encoded Characters

I need to redirect urls from a Centos 6 server with the & encoded as &  Here are some examples:

index.php?controller=cms&id_cms=83
	
index.php?controller=cms&id_cms=60
	
index.php?controller=cms&id_cms=352

Open in new window


I only want them to go to the non encoded equivalent such as this.

RewriteRule ^index\.php\?controller=cms&id_cms=([0-9]+)$  /index.php?controller=cms&id_cms=$1 [R=301,L]

However, this doesn't work so please tell me what I need to do.

Thanks,
Avatar of ssvl
ssvl
Flag of United States of America image

Try this

Internal Function
MapType: int, MapSource: Internal Apache function

Here, the source is an internal Apache function. Module authors can provide additional internal functions by registering them with the ap_register_rewrite_mapfunc API. The functions that are provided by default are:

    toupper:
    Converts the key to all upper case.
    tolower:
    Converts the key to all lower case.
    escape:
    Translates special characters in the key to hex-encodings.
    unescape:
    Translates hex-encodings in the key back to special characters.


http://httpd.apache.org/docs/2.2/mod/mod_rewrite.html#rewriteflags
Avatar of sharingsunshine

ASKER

I think you might be correct but I don't know how to do a rewritemap so can you take my url and provide the code I need to make it work?
ASKER CERTIFIED SOLUTION
Avatar of Steve Bink
Steve Bink
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
What server-side language is your application using?
php
I agree I will go back to the application to change the url's.