解决LAMP环境下访问域名显示403错误的问题
来源:千越SEO 浏览:481环境:阿里云ECS云服务器,Centos 7.3,LAMP
问题:带www域名访问正常,不带www域名访问显示403 Forbidden,301重定向无效(后来发现当时配置环境时只绑了带www的二级域名,没绑定主域名)
解决方案:
通过此文件增加主域名绑定/usr/local/apache/conf/vhost/域名.conf
<VirtualHost *:80> ServerAdmin admin@example.com DocumentRoot "/*/wwwroot/www.域名.com" ServerName www.域名.com
在以上代码下增加:
ServerAlias 域名.com
重启Apache
service httpd {start|stop|status|restart}