Book Image

CodeIgniter Web Application Blueprints

Book Image

CodeIgniter Web Application Blueprints

Overview of this book

Table of Contents (16 chapters)
CodeIgniter Web Application Blueprints
Credits
About the Author
About the Reviewers
www.PacktPub.com
Preface
Index

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:

  1. 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
      
  2. 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>