如何将非WWW网站重定向到Unmanager Server上的WWW版本? [英] How to Redirect Non WWW Website to WWW Version on Unmanager Server?

查看:85
本文介绍了如何将非WWW网站重定向到Unmanager Server上的WWW版本?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的网站托管在Digital Ocean&通过Serverpilot安装了Wordpress.当前主页URL为www.xyz.com& xyz.com也正在对其进行重定向.

I have hosted my Website on Digital Ocean & Installed Wordpress through Serverpilot. Current Home Page URL is www.xyz.com & xyz.com is also redirecting on it.

但是当我打开xyz.com/test-post时,它不会在www.xyz.com/test-post上重新编辑.如何重定向?

But When I open xyz.com/test-post its not rediecting on www.xyz.com/test-post. How can I Redirect it ?

推荐答案

WordPress地址(URL)站点地址中设置URL的www版本 (URL)字段位于WordPress(后端)下

Set the www version of URL in WordPress Address (URL) and Site Address (URL) fields present under WordPress (backend)

,然后将其写入您的.htaccess文件

and then write this in your .htaccess file

# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteCond %{HTTP_HOST} ^yourdomain.com [NC]
RewriteRule ^(.*)$ http://www.yourdomain.com/$1 [L,R=301]

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

希望这对您有所帮助.

这篇关于如何将非WWW网站重定向到Unmanager Server上的WWW版本?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆