- 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>
推薦閱讀
- 零基礎PHP學習筆記
- Building a Game with Unity and Blender
- Magento 2 Theme Design(Second Edition)
- Implementing Cisco Networking Solutions
- 21天學通C++(第6版)
- Java Web開發技術教程
- Mastering Linux Security and Hardening
- 新一代SDN:VMware NSX 網絡原理與實踐
- 響應式Web設計:HTML5和CSS3實戰(第2版)
- SQL Server 2016 從入門到實戰(視頻教學版)
- AutoCAD基礎教程
- Java程序設計實用教程(第2版)
- JBoss AS 7 Development
- 深度學習的數學:使用Python語言
- Learning Java Lambdas