Rumah  >  Artikel  >  pembangunan bahagian belakang  >  xampp怎么隐藏index.php

xampp怎么隐藏index.php

藏色散人
藏色散人asal
2021-10-19 11:24:021952semak imbas

xampp隐藏index.php的方法:1、配置httpd-vhosts.conf和httpd.conf文件;2、打开本机host文件,并在文件末尾添加虚拟域名即可。

xampp怎么隐藏index.php

本文操作环境:macOS10.15.4系统、thinkphp v5.0.7 && XAMPP(PHP)5.6.30版、MacBook Air 2019电脑

xampp怎么隐藏index.php?

MAC + XAMPP + TP5 + 虚拟域名 + 隐藏index.php

1、配置Apache /Applications/XAMPP/xamppfiles/etc/extra/httpd-vhosts.conf 文件

sudo vim /Applications/XAMPP/xamppfiles/etc/extra/httpd-vhosts.conf 
//处理多站点localhost访问
<VirtualHost *:80>
    DocumentRoot "/Applications/XAMPP/xamppfiles/htdocs"
    ServerName localhost
</VirtualHost>
//
<VirtualHost *:80>
    DocumentRoot "/Applications/XAMPP/xamppfiles/htdocs/zerg/public"//替换为自己的网站根目录
    ServerName cm.com //替换为自己的虚拟域名
</VirtualHost>

2、配置Apache /Applications/XAMPP/xamppfiles/etc/httpd.conf

sudo vim /Applications/XAMPP/xamppfiles/etc/httpd.conf
# Virtual hosts //开启虚拟主机配置
Include etc/extra/httpd-vhosts.conf  //去掉该语句前的#号

3、配置本机host文件

sudo vim /etc/hosts
//在文件末尾添加虚拟域名配置
127.0.0.1 cm.com

如果无法隐藏index.php入口文件,可能原因是虚拟域名不合法,重新设置虚拟域名即可

推荐学习:《PHP视频教程

Atas ialah kandungan terperinci xampp怎么隐藏index.php. Untuk maklumat lanjut, sila ikut artikel berkaitan lain di laman web China PHP!

Kenyataan:
Kandungan artikel ini disumbangkan secara sukarela oleh netizen, dan hak cipta adalah milik pengarang asal. Laman web ini tidak memikul tanggungjawab undang-undang yang sepadan. Jika anda menemui sebarang kandungan yang disyaki plagiarisme atau pelanggaran, sila hubungi admin@php.cn
Artikel sebelumnya:php怎么输出昨天是星期几Artikel seterusnya:php怎么实现telnet