重定向“ www”到“ http://” .htaccess文件的WordPress网站

发布于 2025-02-13 05:11:23 字数 858 浏览 0 评论 0原文

我在用“ 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 :

homepage www

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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

只涨不跌 2025-02-20 05:11:23

关于实施重定向时您网站的崩溃。在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.

青巷忧颜 2025-02-20 05:11:23

好的,@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 ;)

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文