Home >Backend Development >PHP Problem >How to hide index.php in ci framework
How to hide index.php in the ci framework: first modify the apache configuration file; then create the htaccess file; then modify the Ci configuration file; and finally restart apache.
Recommended: "PHP Video Tutorial"
去掉前面的#
LoadModule rewrite_module modules/mod_rewrite.so
For Ubuntu, you need to create a soft connection in the mods-enabled folder in the apache installation directory.
Enter /mods-enabled,
-s ../mods-available/rewrite.load rewrite.load # 要确保 ../mods-available/rewrite.load 文件存在,不存在需要安装rewrite模块
Note: Under the apache installation directory: mods-available---unenabled modules, mods-enabled----enabled modules
You can add the following code at the end of the apache configuration file conf/httpd.conf, or in sites- Create a new .conf file in the enabled folder, with any file name, or you can create a link like mods-enabled/.
Alias /athena "/home/liuqian/workspace/athena/" # 依据实际情况改为自己的路径<Directory "/home/liuqian/workspace/athena/"> # 依据实际情况改为自己的路径 Options Indexes MultiViews FollowSymLinks AllowOverride All # 主要是这个 Order allow,deny Allow from all</Directory>
Note: In the apache installation directory: sites-available---unloaded configuration file, sites-enabled----loaded configuration file
Enter the project folder and create the .htaccess file in the directory where index.php is located
Write the following in the file:
/%{REQUEST_FILENAME} !-%{REQUEST_FILENAME} !- !^(index\.php| index.php
$config['index_page'] = "index.php";
to:
$config['index_page'] = "";
sudo apachectl restart # 这里是ubuntu的重启命令
The above is the detailed content of How to hide index.php in ci framework. For more information, please follow other related articles on the PHP Chinese website!