Answer the question
In order to leave comments, you need to log in
How to make a correct redirect in .htaccess?
Hello!
The site needed a 301 redirect.
At the root of the site is .htaccess with the following content:
.htaccess
<FilesMatch "\.md5$">
Deny from all
</FilesMatch>
DirectoryIndex index.php
Options -Indexes
# Comment the following line, if 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/
site.ru/category/zhenskaya-parfumeria/issues
site.ru/zhenskaya-parfumeria/which is what you need, but if the link contains UTM tags of the form:
& utm_source=yandex&utm_medium=cpc&utm_campaign=parfum/the server gives a 404 error.
?utmare working correctly.
Answer the question
In order to leave comments, you need to log in
I'm actually not an expert in .htaccess, try
Redirect 301 /category/zhenskaya-parfumeria(.*) site.ru/zhenskaya-parfumeria/?$1
You can do it like this:
RewriteEngine On
Options +FollowSymLinks
RewriteRule ^category/zhenskaya-parfumeria$ /zhenskaya-parfumeria$1 [QSA,NC,R=301,L]
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question