How to make the correct redirect .htaccess?

Hello!

On the website there was a need to do a 301 redirect.
In the site root is .htaccess with the following content:
.htaccess
<filesmatch "\.md5$">
 Deny from all
</filesmatch>
DirectoryIndex index.php
Options-Indexes
# Comment the following line, if the option Multiviews not allowed here
Options-MultiViews
AddDefaultCharset utf-8
<ifmodule mod_rewrite.c>
 RewriteEngine On
 RewriteCond %{REQUEST_URI} !\.(js|css|jpg|jpeg|gif|png)$
 RewriteCond %{REQUEST_FILENAME} !-f
 RewriteCond %{REQUEST_FILENAME} !-d
 RewriteRule ^(.*)$ index.php [L,QSA]
</ifmodule>
<ifmodule mod_headers.c>
 <filesmatch "\.(jpg|jpeg|png|gif|js|css)$">
 Header set Cache-Control "max-age=3153600, public"
</filesmatch>
</ifmodule>
Redirect 301 /category/zhenskaya-parfumeria/ http://site.ru/zhenskaya-parfumeria/

When you click on the link:
site.ru/category/zhenskaya-parfumeria/
issues
site.ru/zhenskaya-parfumeria/
what you need, but if the url has UTM codes of the form:
&utm_source=yandex&utm_medium=cpc&utm_campaign=parfum/
the server provides a 404 error.
With this label, starting with
?utm
work correctly.
Tell me how to do correctly redirect to work &utm codes? Will replace in htaccess symbol "&" with "?" and how to make it?
September 26th 19 at 11:28
2 answers
September 26th 19 at 11:30
I'm not good at .htaccess, try

Redirect 301 /category/zhenskaya-parfumeria(.*) site.ru/zhenskaya-parfumeria/?$1
September 26th 19 at 11:32
You can do this:
RewriteEngine On
Options +FollowSymLinks
RewriteRule ^category/zhenskaya-parfumeria$ /zhenskaya-parfumeria$1 [QSA,NC,R=301,L]

Here is a good article which describes the flags and commands for all redirects.

Find more questions by tags htaccess