I Made Krisna's Times My Way to Write the Times

27May/100

Removing ‘index.php’ from CodeIgniter URL

CodeIgniter is the one of most famous PHP Framework now. But if we're using CodeIgniter, by default the URL will be shown as http://localhost/index.php/welcome. Some people doesn't like this way to accessing a website, the index.php suffix in the URL.

Here is some step that can make us accessing the website using http://localhost/welcome. But we're also still accessing the url ith index.php suffix. Before, i will list my system so if we're using different system it may cause different solution.

  1. Apache 2.2.14
  2. PHP 5.2.12

STEP one : create .htaccess file

<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /

#Removes access to the system folder by users.
#Additionally this will allow you to create a System.php controller,
#previously this would not have been possible.
#‘system’ can be replaced if you have renamed your system folder.
RewriteCond %{REQUEST_URI} ^system.*
RewriteRule ^(.*)$ /index.php/$1 [L]

#Checks to see if the user is attempting to access a valid file,
#such as an image or css document, if this isn’t true it sends the
#request to index.php
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
#This last condition enables access to the images and css folders, and the robots.txt file
#Submitted by Michael Radlmaier (mradlmaier)
RewriteCond $1 !^(index\.php|images|robots\.txt|css)
RewriteRule ^(.*)$ index.php/$1 [L]
</IfModule>

<IfModule !mod_rewrite.c>
# If we don’t have mod_rewrite installed, all 404’s
# can be sent to index.php, and everything works as normal.
# Submitted by: ElliotHaughin

ErrorDocument 404 /index.php
</IfModule>

STEP two : edit CodeIgniter Configuration

$config['index_page'] = "index.php";

TO

$config['index_page'] = "";

That's all. Go and try that....

Source and References

  1. http://arifn.web.id/blog/2009/02/06/codeigniter-removing-indexphp.html
27May/100

CodeIgniter Code Completion NetBeans IDE

Sorry, but this post no longer works because of the references sites has been closed

CodeIgniter

CodeIgniter, this is one of PHP Framework that can make our job to do PHP Programming easier. You can get that CodeIgniter framework here [Download CodeIgniter]. At this written, the latest version of CodeIgniter was 1.7.2

The problem is if we're using CodeIgniter or other PHP Framework, the IDE like Dreamweaver or NetBeans cannot use their main features, Code Completion. What is Code Completion? That's the feature which can help us to show the functions or variable that can be used. Example if we just use native PHP on Dreamweaver, we just write "mysql_" then there's must be shown the functions which use "mysql_" prefix.

Thanks to Rakibul Hasan, my references of this post. We now can solve the problems, we can use code completion for CodeIgniter on NetBeans. How?

  1. Download the CodeIgniter PHP Framework
  2. Extract it on your Webserver so that you can run it a http://localhost/YOUR_CI
  3. Open your CodeIgniter project with NetBeans
    1. Click File >> New Project >> Choose PHP >> PHP Application with Existing Source
    2. Choose your CodeIgniter folder, example [C:\xampp\htdocs\ci] >> Next
    3. Choose your server type, leave it if you work locally
    4. Finish
  4. Check your CodeIgniter folder example [C:\xampp\htdocs\ci], there must be 'nbproject' folder
  5. Download the files from here [CodeIgniter Code Completion for Netbeans]
  6. Extract the .zip files anywhere
  7. Copy that files to 'nbproject'
  8. Close your NetBeans and Open it again... Finish, check it out!

On my experience, that code completion only works at Controllers and Models, not working at Views. For more information and question you can go to my references site.

Source and References :

  1. http://rhasan.com/blog/2009/09/codeigniter-auto-complete-with-netbeans/
  2. CodeIgniter.com