网址被重定向到https://2day.news/而不是https://www.2day.news/。 这发生在每个浏览器/移动设备上,清除缓存。我不认为这与服务器备份有关,因为当我将重定向更改为不存在的页面时它变为空白。
# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteCond %{HTTP_HOST} ^2day.news [NC]
RewriteCond %{SERVER_PORT} 80
RewriteRule ^(.*)$ https://www.2day.news/$1 [R=301,L]
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>
# END WordPress
答案 0 :(得分:1)
在RewriteBase
之后添加301,www和https# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteCond %{HTTPS} off [OR]
RewriteCond %{HTTP_HOST} !^www\.2day\.news$ [NC]
RewriteRule ^(.*)$ https://www.2day.news/$1 [L,R=301]
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>
# END WordPress
答案 1 :(得分:0)
在某些服务器上,.htaccess
中从非www重定向到www会导致Too many redirections
错误。所以我建议更改数据库中的siteurl。
您可以在wp_options
表格的以下选项的option_value
列中更改网站的网址: siteurl ,主页
或者在WP管理员中,在“设置”下;一般(Wordpress URL和网站URL)。
您需要添加www。两个选项的前缀。
请注意:
- 两个记录应该相同(或者由于跨域问题,某些功能可能无效)
- 您需要在更改后再次登录WP管理员