通常我们注册的域名都是顶级域名  如 www.potatog.com,我们希望这个域名可以访问服务器的不同网站或者不同功能等等 可能会这样 www.potatog.com/api 或者 www.potatog.com/admin,,,另一种二级域名的方式 api.potatog.com来指向特定目录

在httpd.conf中添加如下内容

顶级域名指定一个目录

<VirtualHost *:80>
  ServerAdmin admin@potatog.com
  DocumentRoot "C:\xampp\htdocs"
  ServerName www.potatog.com
  ErrorLog "C:\xampp\apache\logs\www.potatog.localhost-error.log"
  CustomLog "C:\xampp\apache\logs\www.potatog.localhost.access.log" combined
</VirtualHost>

二级域名指定一个目录

<VirtualHost *:80>
  ServerAdmin admin@potatog.com
  DocumentRoot "C:\xampp\htdocs\api"
  ServerName api.potatog.com
  ErrorLog "C:\xampp\apache\logs\api.potatog.localhost-error.log"
  CustomLog "C:\xampp\apache\logs\api.potatog.localhost.access.log" combined
</VirtualHost>

参考:

https://www.cnblogs.com/phonecom/p/6363268.html

 

相关文章:

  • 2021-12-12
  • 2022-12-23
  • 2021-09-09
  • 2021-12-16
  • 2021-05-24
  • 2021-08-08
  • 2021-11-26
  • 2022-02-06
猜你喜欢
  • 2021-10-21
  • 2021-10-10
  • 2021-12-17
  • 2021-09-07
  • 2021-12-18
  • 2022-12-23
  • 2021-08-21
相关资源
相似解决方案