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

asked on

Need To Remove Appended %3F from URL.

I need to remove an encoded ? (%3F) off of several url's.  I want to use Mod_Rewrite to accomplish that.  Here is my regex but it itsn't working.

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

Open in new window


This is what the original url looks like
/index.php?controller=cms&id_cms=73%3F

Open in new window


Please tell me how to get rid of the %3F appended to the url.
Avatar of Dr. Klahn
Dr. Klahn

The regex does not match the URL.  Two reasons.

1.  The URL begins with a slash.  The regex does not.  Add a leading slash on the regex.

2.  The URL contains no underscore between "cms" and "id" -- id cms.  The regex contains an underscore -- id_cms.  Replace the underscore with a space in the regex.
Avatar of sharingsunshine

ASKER

I have looked at your response numerous times and I see id_cms on the regex pattern and on the url.  So to remove this misunderstanding could you please show me what you have gotten to work in a tester.

Thanks,
On my screen there is no underscore between "id cms".

User generated image
Regarding testing the regex, as a long-time EE user you must know that testing with a regex tester is not a substitute for testing in the operational environment.  Only you can test on the actual system.
Wow, that is strange.  Here is what I posted on the original question.  https://gyazo.com/d67e931d75df84a9259e87fd48bb7b0e

You are correct about testing but at least you can get close with a tester.

This is the tester I use and I did add the slash based on your suggestion but it still doesn't match

https://gyazo.com/0cbaf16c8898b1889a4a083c1843abb7
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
Great job, thanks so much for the help.