標籤:style http io strong 檔案 sp on c ad
apache去掉index.php
1.編輯conf/httpd.conf設定檔
#LoadModule rewrite_module modules/mod_rewrite.so 把該行前的#去掉
同時對應Directory下要配置 AllowOverride All
2.在 CI 根目錄下(即在index.php,system的同級目錄下)建立立一個設定檔,命名為: .htaccess 內容如下:
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond $1 !^(index\.php|robots\.txt)
RewriteRule ^(.*)$ index.php/$1
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(application|modules|plugins|system|themes) index.php/$1 [L]
3.把system/application/config/config.php 中$config[‘index_page‘] = "index.php";改為$config[‘index_page‘] = "";
4.重啟apache
nginx去掉index.php
1.編輯nginx.conf檔案
vi /usr/local/xxxxx/nginx/conf/nginx.conf
#nginx去掉index.php
location / {
rewrite ^/$ /index.php last;
#防止某些檔案夾被直接存取
rewrite ^/(?!index\.php|robots\.txt|uploadedImages|resource|images|js|css|styles|static)(.*)$ /index.php/$1 last;
}
2.config/config.php下配置$config[‘index_page‘] = ‘‘;
3..重啟nginx
CI路徑中如何去掉index.php