I
I
Ilya Folg2020-10-12 13:27:29
htaccess
Ilya Folg, 2020-10-12 13:27:29

Is the .htaccess entry configured correctly?

I set up a redirect from http to → https and from www to → without www.

The code:

# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>

# END WordPress


<ifModule mod_gzip.c>
 mod_gzip_on Yes
 mod_gzip_dechunk Yes
 mod_gzip_item_include file \.(html?|txt|css|js|php)$
 mod_gzip_item_include handler ^cgi-script$
 mod_gzip_item_include mime ^text/.*
 mod_gzip_item_include mime ^application/x-javascript.*
 mod_gzip_item_exclude mime ^image/.*
 mod_gzip_item_exclude rspheader ^Content-Encoding:.*gzip.*
</ifModule>

RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(([^/]+/)*[^.]+)$ /$1.php [L]
RewriteCond %{REQUEST_URI} ^/index$ [OR]
RewriteCond %{REQUEST_URI} ^/index[.]+(\w+)$
RewriteRule . / [R=301,L]

RewriteEngine On
RewriteCond %{REQUEST_METHOD} POST
RewriteCond %{REQUEST_URI} .wp-comments-post\.php*
RewriteCond %{HTTP_REFERER} !.*wpmen.ru.* [OR]
RewriteCond %{HTTP_USER_AGENT} ^$
RewriteRule (.*) ^http://%{REMOTE_ADDR}/$ [R=301,L]

RewriteEngine On
RewriteCond %{HTTP_HOST} ^www.rentavto.ru$ [NC]
RewriteRule ^(.*)$ https://rentavto.ru/$1 [R=301,L]

RewriteEngine On  
RewriteCond %{HTTP:X-Forwarded-Protocol} !=https
RewriteRule .* https://%{SERVER_NAME}%{REQUEST_URI} [R=301,L]

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
AgeWalker, 2020-10-13
@AgeWalker

Everything is correct in my opinion. There are 301 redirects everywhere (with http and www).
What's embarrassing?
Here are the tests:
https://bertal.ru/index.php?a8342469/https://www.r...
https://bertal.ru/index.php?a8342452/www.rentavto.ru#h
https: //bertal.ru/index.php?a8342463/rentavto.ru#h

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question