Home  >  Article  >  Backend Development  >  Detailed explanation of steps to hide entry files in PHP

Detailed explanation of steps to hide entry files in PHP

php中世界最好的语言
php中世界最好的语言Original
2018-05-18 10:15:193115browse

这次给大家带来PHP隐藏入口文件步骤详解,PHP隐藏入口文件的注意事项有哪些,下面就是实战案例,一起来看一下。

第一步:开启apache重写模块 重启apache

LoadModule rewrite_module modules/mod_rewrite.so

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

内容如下:

<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

效果如下:

相信看了本文案例你已经掌握了方法,更多精彩请关注php中文网其它相关文章!

推荐阅读:

PECL方式安装php-mongodb扩展步骤详解

php不编译即可安装openssl扩展步骤详解

The above is the detailed content of Detailed explanation of steps 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