12

阿里云虚拟主机 301 重定向

 3 years ago
source link: https://blog.46cbm.top/blog/427.html
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
neoserver,ios ssh client
首页 » 建站 » 阿里云虚拟主机 301 重定向

阿里云虚拟主机 301 重定向

本文最后更新时间为:2021 年 12 月 09 日 14:16:49,部分内容具有时效性,请自行斟酌确认。

今天完成了网站域名和服务器的迁移,搬站之后,看了眼百度的迁移规则,要用 301 跳转。

在阿里云的后台看了一下,发现主机管理里面的 301 跳转只支持阿里云备案的域名,所以只能修改 .htaccess 文件了。

下载之后,在通过编辑打开 .htaccess,在里面加上了跳转代码:

RewriteEngine On

RewriteCond %{HTTP_HOST} !^blog.46cbm.top$ [NC]

RewriteRule ^(.*)$ https://blog.46cbm.top/$1 [R=301,L]

上面 blog.46cbm.top 是我要跳转的新网站,大家用的时候改成自己的就行。

我之前关于关于虚拟机伪静态的文章中有过相关的记录,把上面的代码第二行和第三行加到</IfModule>标签前面就行。

标签: 博客, 网站, 建站, 搬家

本作品采用 知识共享署名-相同方式共享 4.0 国际许可协议 进行许可。

添加新评论

7+12 =


About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK