公司要用.com域名,顺带着把net、.cn也给申请了。
1、将域名解析到服务器IP
2、在http.conf中添加
# set .net to .com
<VirtualHost 1.1.1.1:80>
ServerName xxxx.net
ServerAlias www.xxxx.net
RedirectMatch Permanent ^/(.*) http://xxxx.com/$1
</VirtualHost>
# set .cn to .com
<VirtualHost 1.1.1.1:80>
ServerName xxxx.cn
ServerAlias www.xxxx.cn
RedirectMatch Permanent ^/(.*) http://xxxx.com/$1
</VirtualHost>
<VirtualHost 1.1.1.1:80>
ServerAdmin xxxx@qq.com
ServerName xxxx.com
ServerAlias www.xxxx.com
</VirtualHost>
3、重启Apache服务器