重定向“ www”到“ http://” .htaccess文件的WordPress网站
我在用“ www”显示我的WordPress网站时遇到了问题。前缀。
,当我通过http://访问它时,“主页正常显示,当我添加前缀“ www”时。
确实 href =“ https://i.sstatic.net/m2jtu.jpg” rel =“ nofollow noreferrer”> ,
所以我想修改我的WordPress网站的默认值.htaccess:
# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>
# END WordPress
通过添加此redirect规则:
RewriteEngine on
RewriteCond %{HTTP_HOST} ^www.herefor.digital
RewriteRule (.*) http://herefor.digital/$1 [R=301,L]
但是我不要在哪里添加“ www”
。 /语法本身好吗
程序
?
I'm having a problem displaying my Wordpress site with the "www." prefix.
Indeed, when I access it via http://" the homepage is displayed normally, and when I add the prefix "www." it seems that the redirection fails and displays the contents of the directory at the root of the site :
So I wanted to modify the default .htaccess of my Wordpress website :
# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>
# END WordPress
By adding this redirect rule :
RewriteEngine on
RewriteCond %{HTTP_HOST} ^www.herefor.digital
RewriteRule (.*) http://herefor.digital/$1 [R=301,L]
But I don't know where to add the "www." to "http://". This crashes the site.
Yes should I according to add it, and is the procedure/syntax good on its own?
My website link : http://herefor.digital
Thanks a lot
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
关于实施重定向时您网站的崩溃。在WordPress管理中,管理员导航到设置 - &gt;一般的。从那里确保“ WordPress地址(URL)”和“站点地址(URL)”设置为使用https:// www。然后单击“在底部”保存更改。
Regarding the crash of your site when you implement the redirect. Within the WordPress Admin navigate to Settings -> General. From there make sure the "WordPress Address (URL)" and "Site Address (URL)" is set to use https://www. and click Save Changes at the bottom.
好的,@cbroe找到了问题的根源。
我的“ www”主机指向“ ./”,而不是“ ./www”目录。因此,我通过主机界面对此进行了更新,几分钟后,它现在可以使用!
多谢 ;)
Ok @CBroe found the source of the problem.
My "www" host was pointing to "./" instead of the "./www" directory. So I updated this via my host interface and after a few minutes, it now works!
Thanks a lot ;)