How to hide entry files in php

藏色散人
Release: 2023-03-08 18:28:02
Original
2600 people have browsed it

php隐藏入口文件的方法:首先开启apache重写模块;然后在项目根目录与入口文件同级的目录重写分布式配置文件“.htaccess”即可。

How to hide entry files in php

本文操作环境:windows7系统、PHP7.1版,DELL G3电脑

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>
Copy after login

或者【推荐学习:PHP视频教程

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

效果如下:


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!

Related labels:
php
source:php.cn
Statement of this Website
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!