Windows下Apache配置虚拟的二级域名

如下:

一级域名:(cms.com)


    DocumentRoot "D:\phpstudy2018\PHPTutorial\WWW\cms"
    ServerName www.cms.com
    ServerAlias cms.com
  
      Options FollowSymLinks ExecCGI
      AllowOverride All
      Order allow,deny
      Allow from all
     Require all granted
  

二级域名:(手机端访问的时候) (m.cms.com)


    DocumentRoot "D:\phpstudy2018\PHPTutorial\WWW\cms"
    ServerName m.cms.com
  
      Options FollowSymLinks ExecCGI
      AllowOverride All
      Order allow,deny
      Allow from all
     Require all granted
  

host文件下添加对应的选项:

127.0.0.1	www.cms.com cms.com
127.0.0.1	m.cms.com

重启Apache

你可能感兴趣的:(apacahe配置)