首页 > 技术文章 > 个性化域名重定向到博客园–Apache

Yongfeng001 2017-12-13 22:52 原文

开通了博客园页面,深深的被其简洁干净所吸引,顿时想将自己的个人域名重定向到博客园页面。

本来自己有一台 AWS EC2 主机,使用Apache 修改下配置即可。

 

1. 生成新配置文件 redirect_subdomains.conf

# Enable Virtual Host
NameVirtualHost *:80

# Setup redirection
<VirtualHost *:80>
    ServerName blog.zhengyongfeng.cn
    Redirect permanent / http://www.cnblogs.com/yongfeng01/
    ErrorLog logs/blog.zhengyongfeng.cn-error_log
    CustomLog logs/blog.zhengyongfeng.cn-access_log common
</VirtualHost>

 

2. 将编辑好的新文件放在 /etc/httpd/conf.d 即可,然后重启 apache

service httpd restart
Stopping httpd:                                            [  OK  ]
Starting httpd:                                            [  OK  ]

 

3. 访问新链接 http://blog.zhengyongfeng.cn 即可重定向到 http://www.cnblogs.com/yongfeng01/

推荐阅读