How to remove index.php from URLs in CodeIgniter

      Comments Off on How to remove index.php from URLs in CodeIgniter

For Localhost / VPS / Dedicated Hosting

  1. Open the httpd.conf
  2. Find
    LoadModule rewrite_module modules/mod_rewrite.so
  3. Remove # from the beginning of the line
  4. Find AllowOverride then change to be
    <Directory />
    AllowOverride All
    Order deny,allow
    Deny from all
    </Directory>
  5. Save and restart Apache
  6. Create a .htaccess file at the root directory
    #Rewrite index.php
    #Start using rewrite engine
    RewriteEngine On
    #Rewrite condition
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    #Whenever index.php is there in the url, it will rewrite to / automatically
    RewriteRule .* index.php/$0 [PT,L]
  7. Make following changes in application/config.php
    $config['index_page'] = '';
  8. Save the file and you are done

For shared hosting

  1. Create a .htaccess file at the root directory
    #Rewrite index.php
    #Start using rewrite engine
    RewriteEngine On
    #Rewrite condition
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    #Whenever index.php is there in the url, it will rewrite to / automatically
    RewriteRule .* index.php/$0 [PT,L]
  2. Make following changes in application/config.php
    $config['index_page'] = '';
  3. Save the file and you are done

Author: Teji

i am admin


Warning: include(): http:// wrapper is disabled in the server configuration by allow_url_include=0 in /home4/webdekqj/public_html/blog/wp-content/themes/webdesignerinc/single.php on line 32

Warning: include(http://webdesignerinc.com/googleadd.php): Failed to open stream: no suitable wrapper could be found in /home4/webdekqj/public_html/blog/wp-content/themes/webdesignerinc/single.php on line 32

Warning: include(): Failed opening 'http://webdesignerinc.com/googleadd.php' for inclusion (include_path='.:/opt/cpanel/ea-php80/root/usr/share/pear') in /home4/webdekqj/public_html/blog/wp-content/themes/webdesignerinc/single.php on line 32