標籤:php ci
環境為
windows10
php 5.6
apache2.4
-
在http.conf中開啟LoadModule rewrite_module modules/mod_rewrite.so
將前面的#去掉
<Directory "D:/">
#
# Possible values for the Options directive are "None", "All",
# or any combination of:
# Indexes Includes FollowSymLinks SymLinksifOwnerMatch ExecCGI MultiViews
#
# Note that "MultiViews" must be named *explicitly* --- "Options All"
# doesn‘t give it to you.
#
# The Options directive is both complicated and important. Please see
# http://httpd.apache.org/docs/2.4/mod/core.html#options
# for more information.
#
Options Indexes FollowSymLinks
#
# AllowOverride controls what directives may be placed in .htaccess files.
# It can be "All", "None", or any combination of the keywords:
# Options FileInfo AuthConfig Limit
#
AllowOverride All
#
# Controls who can get stuff from this server.
#
Require all granted
</Directory>
AllowOverride None將其改為AllowOverride All
2.進入到CI根目錄,建立.htaccess檔案,輸入
RewriteEngine on
RewriteCond $1 !^(index\.php|style|robots\.txt)
RewriteRule ^(.*)$ /index.php/$1 [L]
當然如果你的目錄不是根目錄,則要注意,比如我的URL為
http://myweb.com/citest/
,則最後一行 要改為
RewriteRule ^(.*)$ /ci/index.php/$1 [L]
3. 將CI中設定檔(application/config/config.php)中
$config[‘index_page‘] = "index.php";
改成
$config[‘index_page‘] = "";
4.重啟apache
本文出自 “IT技術” 部落格,請務必保留此出處http://linuxubuntu.blog.51cto.com/4964714/1897320
CI 3.1.3隱藏index.php