多个域名重定向(301)到一个域名 Apache

公司要用.com域名,顺带着把net、.cn也给申请了。

1、将域名解析到服务器IP

2、在http.conf中添加

# set .net to .com

        ServerName xxxx.net
        ServerAlias www.xxxx.net
        RedirectMatch Permanent ^/(.*) http://xxxx.com/$1

# set .cn to .com

        ServerName xxxx.cn
        ServerAlias www.xxxx.cn
        RedirectMatch Permanent ^/(.*) http://xxxx.com/$1


    ServerAdmin [email protected]
    ServerName xxxx.com
    ServerAlias www.xxxx.com

3、重启Apache服务器

你可能感兴趣的:(Apache)