Tags

, , ,

### Enable the mod rewrite
$ sudo a2enmod rewrite

### Update the website configuration
$ sudo vi /etc/apache2/sites-enabled/ciblog.local.conf 
ServerAdmin webmaster@localhost
        DocumentRoot /var/www/_php/sample-blog
        ServerName ciblog.local:8081
        ServerAlias ciblog.local
    {Directory}
      Options Indexes FollowSymLinks MultiViews
      AllowOverride All
      Order allow,deny
      Allow from all
    {/Directory}

$ sudo /etc/init.d/apache2 restart

### Then create .htaccess file in the root of your codeigniter app
  SetEnv CI_ENV development
  RewriteEngine On
  # !IMPORTANT! Set your RewriteBase here and don't forget trailing and leading
  #  slashes.
  # If your page resides at
  #  http://www.example.com/mypage/test1
  # then use
  # RewriteBase /mypage/test1/
  RewriteBase /
  RewriteCond %{REQUEST_FILENAME} !-f
  RewriteCond %{REQUEST_FILENAME} !-d
  RewriteCond $1 !^(index\.php|css|js|uploads|img|assets|fonts|robots\.txt|css)
  RewriteRule ^(.*)$ index.php?/$1 [L]
  # 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

Note: Replace the open/closed braces { } with less/greater than symbols respectively.

Advertisements