Saturday, May 3, 2014

How to remove index.php from CodeIgniter URL in Ubuntu

[caption id="attachment_979" align="aligncenter" width="225"]Codeigniter CodeIgniter[/caption]

 

In application/config/config.php change:
$config['index_page']='index.php';

to:
$config['index_page']='';

 

Create or modify .htaccess in project root with following content.
# Customized error messages.
ErrorDocument 404 /index.php
# Set the default handler.
DirectoryIndex index.php
# Various rewrite rules.
<IfModule mod_rewrite.c>
  RewriteEngine on
  RewriteCond %{REQUEST_FILENAME} !-f
  RewriteCond %{REQUEST_FILENAME} !-d
  RewriteRule ^(.*)$ index.php?/$1 [L,QSA]
</IfModule>

Also allow overriding htaccess in your apache
/etc/apache2/sites-available/default

and edit the file & change to
AllowOverrideAll

and

Restart Apache

 
sudo /etc/init.d/apache2 reload

or:
sudo service apache2 reload

or:
sudo /etc/init.d/httpd reload

1 comment:

How to enable CORS in Laravel 5

https://www.youtube.com/watch?v=PozYTvmgcVE 1. Add middleware php artisan make:middleware Cors return $next($request) ->header('Acces...