Home > Backend Development > PHP Tutorial > Summarize the steps to hide the index.php file

Summarize the steps to hide the index.php file

巴扎黑
Release: 2023-03-02 18:02:01
Original
2244 people have browsed it

Summarize the steps to hide the index.php file
1. Turn on the mod_rewrite module of apache
Remove the "#" symbol in front of LoadModule rewrite_module modules/mod_rewrite.so
Make sure There is "AllowOverride All" in
2. Add the code in /protected/config/main.php in the project:

'components'=>array(
' urlformat '= & gt;' path ',
' showscriptname '= & gt; false, // Note that False should not include quotes
' urlsuffix '= & gt;'. HTML ',
' rules' = & gt; Array (
' sites'=>'site/index',
                                                                                 Add the file ".htaccess" in the same directory as the .php file with the following content :

    Options +FollowSymLinks             IndexIgnore */*                                              ‐ ‐ ‐ ‐ ‐ ‐‐‐‐‐ RewriteCond %{REQUEST_FILENAME} !- f
          RewriteCond %{REQUEST_FILENAME} !-d                                                      forward it to index.php
RewriteRule . index.php

Copy the code
This way you can hide the index.php entry file.

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