Home  >  Article  >  Backend Development  >  How to hide entry files in php

How to hide entry files in php

王林
王林Original
2020-08-15 15:56:033073browse

php隐藏入口文件的方法:1、开启apache重写模块;2、重启apache;3、在项目根目录与入口文件同级的目录重写分布式配置文件【.htaccess】即可。

How to hide entry files in php

具体方法:

(推荐教程:php图文教程

一、开启apache重写模块并重启apache

LoadModule rewrite_module modules/mod_rewrite.so

How to hide entry files in php

二、在项目根目录与入口文件同级的目录重写分布式配置文件.htaccess 

(视频教程推荐:php视频教程

How to hide entry files in php

内容如下:

<IfModule mod_rewrite.c>  
Options +FollowSymlinks  
RewriteEngine On  #分布式配置文件 隐藏入口文件  
RewriteCond %{REQUEST_FILENAME} !-d  
RewriteCond %{REQUEST_FILENAME} !-f  
RewriteRule ^(.*)$ index.php/$1 [QSA,PT,L]
</IfModule>

或者

RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule (.*) index.php/$1

The above is the detailed content of How to hide entry files in php. For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn