K
K
krispey2021-09-03 14:47:15
htaccess
krispey, 2021-09-03 14:47:15

Htaccess redirect from url at end with question mark to without?

There are many duplicate pages, with urls ending with question marks.
For example site.ru/services/shkola/?

How to make a 301 redirect to a page without a question?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
D
dodo512, 2021-09-03
@krispey

At the beginning of .htaccess add

RewriteEngine on

RewriteCond %{THE_REQUEST} "^\S+ /[^?]*\? "
RewriteRule .* /$0? [R=301,L]

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question