CodeIgniter - removing "index.php"
One of my friend just started to learn CodeIgniter.For a starter, CodeIgniter as php framework is a great and easy one to understand.
I realize that a lot of people who try CodeIgniter always getting a hard time understanding how to make link on CodeIgniter (Ex: href="" or src=""). Well, it is pretty confusing in the beginning but as time and projects gone by, I started to get the drill.
Now I want to share a thing about this ".htaccess" thing which allow us to remove the "index.php" on our url.
Here it is:
.HTACCESS to remove "index.php"
Use this on local "apache" web server:
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php/$1 [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php/$1 [L]
Use this when using shared hosting or any hosting:
RewriteEngine on
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php?/$1 [L]
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php?/$1 [L]
Hope this can help you all. Thank for read my article.
Happy Coding :)
Komentar
Posting Komentar