上周,我将我的网站从HTTP改为HTTPS。
尽管中有301重定向规则.htaccess
, 出于某种原因,所有旧(HTTP)页面都会使用302重定向进行重定向。我找不到这是什么,也没有更改任何插件。我唯一创建的是.htaccess
. 网站url=https://www.janjippe.nl/
以下是我的.htaccess
文件:
#BEGIN Wordpress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteCond %{HTTPS} !=on
RewriteCond %{SERVER_PORT} ^80$
RewriteRule ^(.*)$ https://%{HTTP_HOST}%{REQUEST_URI} [R=301,L]
RewriteBase /
RewriteRule ^index\\.php$ – [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L] </IfModule>
# END WordPress
然而,目前,在检查所有页面时,我只看到302个重定向。如何确保301重定向而不是302重定向到位?这对private_html
文件夹
这个public_html
文件夹为空,1除外.htaccess
包含以下内容的文件:
RewriteEngine On
RewriteCond %{SERVER_PORT} 80
RewriteRule ^(.*)$ https://www.janjippe.nl/$1 [R,L]
<IfModule mod_headers.c>
Header set Strict-Transport-Security "max-age=31536000"
</IfModule>
# BEGIN WpFastestCache
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
AddDefaultCharset UTF-8
RewriteCond %{HTTP_HOST} ^janjippe.nl
RewriteRule ^(.*)$ http\\:\\/\\/www\\.janjippe\\.nl\\/$1 [R=301,L]
RewriteCond %{REQUEST_METHOD} !POST
RewriteCond %{QUERY_STRING} !.*=.*
RewriteCond %{HTTP:X-Wap-Profile} !^[a-z0-9\\"]+ [NC]
RewriteCond %{HTTP:Profile} !^[a-z0-9\\"]+ [NC]
RewriteCond %{DOCUMENT_ROOT}/wp-content/cache/all/$1/index.html -f [or]
RewriteCond /home/janjikm99/domains/janjippe.nl/public_html/wp-content/cache/all/$1/index.html -f
RewriteRule ^(.*) "/wp-content/cache/all/$1/index.html" [L]
</IfModule>
<FilesMatch "\\.(html|htm)$">
FileETag None
<ifModule mod_headers.c>
Header unset ETag
Header set Cache-Control "max-age=0, no-cache, no-store, must-revalidate"
Header set Pragma "no-cache"
Header set Expires "Mon, 29 Oct 1923 20:30:00 GMT"
</ifModule>
</FilesMatch>
# 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