Z
Z
zend12018-11-14 20:04:57
htaccess
zend1, 2018-11-14 20:04:57

How to remove from the link everything after the question mark and the question mark itself?

Please tell me how to use htaccess to cut links with a question mark.
Links are different, I will give an example.
1. sait.ru/abrakadabra?jrjtrjtrjktjkrekt should be sait.ru/abrakadabra
2. sait.ru/tut_toje_cto_to/text_stfti.htm?jdsjfsdjfkjsdfk should be sait.ru/tut_toje_cto_to/text_stfti.htm
Found an example here How to remove the question mark at the end of the url ?
But there is a little wrong, only the question mark is cut off there and only if it is alone at the end of the link. I need to cut off everything after the question mark and the question mark itself.
Help.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
D
dodo512, 2018-11-14
@zend1

RewriteCond %{THE_REQUEST}  \?
RewriteRule ^(.*)$ /$1? [R=301,L]

Append to the beginning of the file.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question