这是我第一次在StackOverflow上提问。
我有一个图书馆系统,包括一个前端和一个使用php的后端。系统的文件结构为:根目录:学位论文/前端:论文/前端/库/index.php后端:论文/后端/base/index.php
当你输入www.example.com时,它会将你重定向到前端,也就是论文/前端/库/index.php;当你输入admin.example.com时,它会重定向到后端,也就是论文/后端/库/index.php。
不知何故,我研究了一些东西,发现创建虚拟主机。但不能做到这一点。
备注:前端获取后端文件夹上的资源(例如图片)。
发布于 2016-09-07 12:51:45
将虚拟主机添加到xampp/apache/conf/extra/httpd-vhosts.conf
# Frontend
<VirtualHost example.com:80>
DocumentRoot "D:/xampp/htdocs/thesis/frontend/library"
ServerName example.com
</VirtualHost>
# Backend
<VirtualHost admin.example.com:80>
DocumentRoot "D:/xampp/htdocs/thesis/backend/base"
ServerName admin.example.com
</VirtualHost>
现在需要在hosts文件中添加记录来解析127.0.0.1中的example.com
打开您的主机文件C:\Windows\System32\drivers\etc\hosts
并添加
127.0.0.1 example.com
127.0.0.1 admin.example.com
重新启动apache
完成
https://stackoverflow.com/questions/39361260
复制相似问题