For Localhost / VPS / Dedicated Hosting
- Open the httpd.conf
- Find
LoadModule rewrite_module modules/mod_rewrite.so
- Remove # from the beginning of the line
- Find AllowOverride then change to be
<Directory />
AllowOverride All
Order deny,allow
Deny from all
</Directory> - Save and restart Apache
- 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] - Make following changes in application/config.php
$config['index_page'] = '';
- Save the file and you are done
For shared hosting
- 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] - Make following changes in application/config.php
$config['index_page'] = '';
- Save the file and you are done