0

A WP plugin is generating URLs with ? parameter separator, instead of &

Something like: https://yourdomain.com/?quiz=lesson-1-quiz-1?id=1260

Is it possible to leave first ? as it is and replace all other with & using .htaccess?

The URL should be: https://yourdomain.com/?quiz=lesson-1-quiz-1&id=1260

4

2 Answers 2

1

With your shown samples, could you please try following. Please make sure you clear your browser cache before testing your URLs.

RewriteEngine ON
RewriteCond %{QUERY_STRING} ^([^?]*)\?(.*)$
RewriteRule ^ %{REQUEST_URI}?%1&%2 [R=301,NE,L]
Sign up to request clarification or add additional context in comments.

Comments

0

You may use this rule as your topmost rule:

RewriteEngine On

RewriteCond %{THE_REQUEST} (\?[^?]*)\?(\S*)\sHTTP [NC]
RewriteRule ^ %{REQUEST_URI}%1&%2 [L,R=302,NE]

# all other rules go below this line

Once you've tested this rule, don't forget to change 302 to 301.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.