这里分享一下Apache配置网站域名301转向,希望对于初学Apache服务器相关的朋友有帮助,更多Apache安装、配置、报错处理等资源请本站内搜索。
apache 配置域名转向(没有3个人,(www)转到www)
<VirtualHost *>
ServerName www.server110.com
DocumentRoot /home/homepage/www/public
<Directory "/home/homepage/www/public/">
AllowOverride none
</Directory>
</VirtualHost>
<VirtualHost *>
ServerName server110.com
RedirectMatch ^/(.*)$ http://www.server110.com/$1 #这里一定要加上http://前缀,否则跳转会出错
</VirtualHost>
最后,重启apache生效
声明: 此文观点不代表本站立场;转载须要保留原文链接;版权疑问请联系我们。