Answer the question
In order to leave comments, you need to log in
How to fix redirect in htaccess?
Hello everyone, such a problem, I'm trying to access the page at
https://site.ru/catalog/
or
https://site.ru/catalog/razdel/
(I tried with / and without it, the result is the same)
The browser gives an error,
Mozilla - Wrong redirect on
Yandex browser page - Site.ru redirected too many times
The htaccess file itself looks like this:
ErrorDocument 404 /error.php
RewriteEngine On
RewriteCond %{SERVER_PORT} !^443$
RewriteRule .* https://%{SERVER_NAME}%{REQUEST_URI} [R=301,L]
RewriteCond %{HTTP_HOST} ^www\.(.*) [NC]
RewriteRule ^(.*)$ https://%1/$1 [R=301,L]
RewriteCond %{THE_REQUEST} ^[A-Z]{3,9}\ /index\.php\ HTTP/
RewriteRule ^index\.php$ https://site.ru [R=301,L]
Redirect 301 /index https://site.ru
RewriteCond %{THE_REQUEST} " (/[^?/]+)\.php"
RewriteRule ^ %1 [R=301,L]
RewriteCond %{REQUEST_FILENAME}.php -f
RewriteRule ^([^/]+)$ /$1.php [L]
RewriteCond %{REQUEST_URI} !\?
RewriteCond %{REQUEST_URI} !\&
RewriteCond %{REQUEST_URI} !\=
RewriteCond %{REQUEST_URI} !\.
RewriteCond %{REQUEST_URI} ![^\/]$
RewriteRule ^(.*)\/$ /$1 [R=301,L]
<IfModule mod_rewrite.c>
RewriteEngine On
# serves a .webp image instead of jpg/png
RewriteCond %{HTTP_ACCEPT} image/webp
RewriteCond %{REQUEST_FILENAME} ^(.+)\.(jpe?g|png)$
RewriteCond %1\.webp -f
RewriteRule ^(.+)\.(jpe?g|png)$ $1.webp [T=image/webp,E=accept:1]
</IfModule>
<IfModule mod_headers.c>
Header append Vary Accept env=REDIRECT_accept
</IfModule>
AddType image/webp .webp
# Заголовок Cache-Control
<IfModule mod_headers.c>
Header append Cache-Control "no-store, no-cache, must-revalidate"
</IfModule>
# Заголовок Expires
<IfModule mod_expires.c>
ExpiresActive On ExpiresDefault "now"
</IfModule>
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