M
M
Marmisha2018-08-21 09:31:32
htaccess
Marmisha, 2018-08-21 09:31:32

Is the redirect from the index pages (.html and .php) configured incorrectly?

Hello. I'm trying to solve a non-typical problem. The point is this. When making settings in .htaccess, to eliminate the error "Redirect from index pages (.html and .php) is not configured correctly" I write:
RewriteCond %{THE_REQUEST} ^[AZ]{3,9}\ /index\.php\ HTTP/
RewriteRule ^index\.php$ site.com [R=301,L]
In this case, the error disappears, but when entering the admin panel (after entering the login, password and pressing the "LOGIN" key), the user is redirected to the main page, and the control panel ( at the top of the site) does not appear. If you just refresh the page (F5), then the control panel appears. The same goes for logging out of your account. Press "EXIT" and again the main page with the control panel. Refresh the page and the panel disappears. Apparently somewhere messed up with .
The .htaccess itself

RewriteEngine On
 RewriteCond %{HTTPS} !=on
 RewriteRule ^.*$ https://%{SERVER_NAME}%{REQUEST_URI} [R,L]

RewriteCond %{REQUEST_URI} /index\.php\ HTTP/
RewriteRule ^index\.php$ http://%{HTTP_HOST}/ [R=301,L]
 
RewriteCond %{THE_REQUEST} ^[A-Z]{3,9}\ /index\.php\ HTTP/
RewriteRule ^index\.php$ http://site.com [R=301,L]
 
ErrorDocument 404 https://site.com/404.php

DirectoryIndex index.php

AddDefaultCharset UTF-8

RewriteCond %{HTTP_HOST} ^www\.(.*)$
RewriteRule ^(.*)$ http://%1/$1 [L,R=301]



## EXPIRES CACHING ##
<IfModule mod_expires.c>
ExpiresActive On
ExpiresByType image/jpg "access plus 1 year"
ExpiresByType image/jpeg "access plus 1 year"
ExpiresByType image/gif "access plus 1 year"
ExpiresByType image/png "access plus 1 year"
ExpiresByType text/css "access plus 1 month"
ExpiresByType application/pdf "access plus 1 month"
ExpiresByType text/x-javascript "access plus 1 month"
ExpiresByType application/x-shockwave-flash "access plus 1 month"
ExpiresByType image/x-icon "access plus 1 year"
ExpiresDefault "access plus 7 days"
ExpiresByType https://mc.yandex.ru/metrika/advert.gif "access plus 1 hour"
ExpiresByType https://mc.yandex.ru/metrika/watch.js "access plus 1 hour"
</IfModule>
## EXPIRES CACHING ##

If you have any ideas to fix this error, I'd love to hear it.

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question