We help IT Professionals succeed at work.

Need To Remove Appended %3F from URL.

261 Views
Last Modified: 2018-09-01
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.
Comment
Watch Question

Dr. KlahnPrincipal Software Engineer
CERTIFIED EXPERT

Commented:
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.

Author

Commented:
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,
Dr. KlahnPrincipal Software Engineer
CERTIFIED EXPERT

Commented:
On my screen there is no underscore between "id cms".

Missing space
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.

Author

Commented:
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
CERTIFIED EXPERT
Top Expert 2004
Commented:
This problem has been solved!
(Unlock this solution with a 7-day Free Trial)
UNLOCK SOLUTION

Author

Commented:
Great job, thanks so much for the help.

Gain unlimited access to on-demand training courses with an Experts Exchange subscription.

Get Access
Why Experts Exchange?

Experts Exchange always has the answer, or at the least points me in the correct direction! It is like having another employee that is extremely experienced.

Jim Murphy
Programmer at Smart IT Solutions

When asked, what has been your best career decision?

Deciding to stick with EE.

Mohamed Asif
Technical Department Head

Being involved with EE helped me to grow personally and professionally.

Carl Webster
CTP, Sr Infrastructure Consultant
Empower Your Career
Did You Know?

We've partnered with two important charities to provide clean water and computer science education to those who need it most. READ MORE

Ask ANY Question

Connect with Certified Experts to gain insight and support on specific technology challenges including:

  • Troubleshooting
  • Research
  • Professional Opinions