0

i am trying to add a rule to my .htaccess file to remove a slash in front of any query string. An URL like https://www.someDomain.com/someText/anotherText/?bp=someNumber should be rewritten to URL https://www.someDomain.com/someText/anotherText?bp=someNumber so there must be no slash in front of the question mark.

Thx

1
  • Trailing slash with query string, it's not the same answer (not a dublicate) ! Commented Aug 28, 2015 at 14:22

1 Answer 1

0

You can use:

RewriteEngine on
RewriteCond %{QUERY_STRING} ^.+$
RewriteRule ^(.*)/$ $1 [L,R=301]

For redirection with code 301

Sign up to request clarification or add additional context in comments.

1 Comment

Thanks a lot. Your rule inserts the local path so i changed it to RewriteRule ^(.*)/$ /$1 [L,R=301] which is working fine.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.