Answer the question
In order to leave comments, you need to log in
What's wrong with this htacess?
I use this htacess, but something is wrong with it. When I remove this htacess, buttons work in the admin panel, in this htacess there are redirects from www to without www, from upper to lower case, etc.
Tell me what's wrong with it?
Shows that I have mixed content in the admin panel when this htacess is present and a couple more points.
#order deny,allow
#deny from all
RewriteEngine on
RewriteBase /
############################################################################
#### Убираем повторяющиеся слеши (/) в URL ####
############################################################################
RewriteCond %{THE_REQUEST} //
# Проверяем, повторяется ли слеш (//) более двух раз.
RewriteRule .* /$0 [R=301,L]
# Исключаем все лишние слеши.
php_value error_reporting 1
RewriteCond %{HTTP_USER_AGENT} ^.*(Chrome/76.0.3809.100).*$ [NC]
RewriteRule .* - [F,L]
#### Убираем слеши в конце URL для статических файлов (содержит точку) ####
############################################################################
RewriteCond %{REQUEST_URI} \..+$
# Если файл содержит точку.
RewriteCond %{REQUEST_FILENAME} !-d
# И это не директория.
RewriteCond %{REQUEST_FILENAME} -f
# Является файлом.
RewriteCond %{REQUEST_URI} ^(.+)/$
# И в конце URL есть слеш.
RewriteRule ^(.+)/$ /$1 [R=301,L]
# Исключить слеш.
######regist####
RewriteCond %{REQUEST_URI} ^[^A-Z]*[A-Z].*
RewriteRule ^ ${lc:%{REQUEST_URI}} [L,R=301]
####
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)/$ /$1 [L,R=301]
RewriteCond %{THE_REQUEST} ^[A-Z]{3,9}\ /index\.php\ HTTP/
RewriteRule ^index\.php$ / [R=301,L]
#RewriteCond %{REQUEST_URI} !^/$
#RewriteCond %{REQUEST_URI} (.*)/$
#RewriteRule . %1 [R=301,L,E=NS:1,QSA]
RewriteCond %{REQUEST_URI} ^\/$
RewriteCond %{HTTP_HOST} ^www\.(.*)$
RewriteRule ^(.*)$ https://%1/$1 [L,R=301]
# if a directory or a file exists, use it directly
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
# otherwise forward it to index.php
RewriteRule . index.php
Redirect 301 /site/index /
RewriteCond %{REQUEST_URI} !^/generate-webp.php$
RewriteCond %{REQUEST_URI} !^/sitemap.php$
RewriteCond %{REQUEST_URI} !^/php.php$
RewriteCond %{REQUEST_URI} !^/allJS\.php?v2$
RewriteCond %{THE_REQUEST} ^[A-Z]{3,}\s([^.]+)\.php [NC]
RewriteRule ^ %1 [R,L,NC]
Answer the question
In order to leave comments, you need to log in
well, it’s easier to say what’s so here
1. I wrote a standard .htacces and everything was thought out in it, you cut out pieces from it, stuck it in different places and ask what went wrong here.
For example, you have only one piece responsible for removing the slash, and your lordship decided not to add a slash to the directories because it was not fate?
2. htaccess is read from top to bottom and sequence is important
3.
upper to lower case, etc.Well, here, so that without swearing, I will answer briefly Linux is a register-sensitive system (this is real if swearing and foam) what kind of "smart" person generally came up with making such redirects deserves a separate place in hell.
you also mixed the rules.
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)/$ /$1 [L,R=301]
#RewriteCond %{REQUEST_URI} !^/$
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question