- CodeIgniter Web Application Blueprints
- Rob Foster
- 124字
- 2021-08-06 19:34:27
Removing index.php from the address bar
It is possible to remove index.php
from the web browser address bar when CodeIgniter is running. This can be done by following these steps:
- Create or open a
.htaccess
file. If a.htaccess
file does not already exist, you can create one using the following:- Linux/Mac: Open a terminal window and type the following:
touch /path/to/CodeIgniter/.htaccess
- Windows: Create a text file in your CodeIgniter root, naming it
file.htaccess
. Hold down the Windows key and then press R to open the Run dialogue. Enter the following command and click on OK:ren "C:\path\to\CodeIgniter\file.htaccess" .htaccess
- Linux/Mac: Open a terminal window and type the following:
- Once your
.htaccess
file is opened, write the following lines at the top of the file:<IfModule mod_rewrite.c> RewriteEngine on RewriteCond $1 !^(index\.php|images|robots\.txt) RewriteRule ^(.*)$ index.php/$1 [L] </IfModule>
推薦閱讀
- 零基礎學Visual C++第3版
- 軟件界面交互設計基礎
- JavaScript從入門到精通(第3版)
- Python高效開發實戰:Django、Tornado、Flask、Twisted(第3版)
- STM32F0實戰:基于HAL庫開發
- Java程序設計入門
- Mastering Web Application Development with AngularJS
- Learning Docker Networking
- Learning Modular Java Programming
- MATLAB GUI純代碼編寫從入門到實戰
- PHP與MySQL權威指南
- Oracle實用教程
- Mastering Adobe Captivate 7
- HTML5游戲開發實戰
- 透視C#核心技術:系統架構及移動端開發