Answer the question
In order to leave comments, you need to log in
How to remove slash and empty data from .htaccess?
Tell me how to remove empty values from the URL using .htaccess, both at the end and in the middle.
For example: site.ru/slovo1//slovo3 should redirect to site.ru/slovo1
And site.ru/slovo1/ to site.ru/slovo1
Now I use the following configuration:
DirectoryIndex index.php
RewriteEngine On
RewriteBase /
RewriteCond %{HTTPS} =off
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ /index.php?do=$1 [L,QSA]
RewriteCond %{HTTP_HOST} !^mysite\.ru
RewriteRule ^(.*)(/)$ http://mysite.ru/$1 [R=301,L]
RewriteCond %{THE_REQUEST} ^GET\ .*/index\.(php|html?)\ HTTP
RewriteRule ^(.*)index\.(php|html?)$ $1 [R=301,L]
AddDefaultCharset utf-8
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question