Posted on Leave a comment

How to remove index.php from codeigniter in UBUNTU?

This tutorial will show you that how to remove index.php from codeigniter in UBUNTU or how to enable url rewriting.

Step 1 :

Add this in htaccess file

<IfModule mod_rewrite.c>
  RewriteEngine On
  #RewriteBase /

  RewriteCond %{REQUEST_FILENAME} !-f
  RewriteRule ^ index.php [QSA,L]

Step 2 :

Remove index.php in codeigniter config

$config['index_page'] = '';

Step 3 :

Allow overriding htaccess in Apache Configuration (Command)

sudo nano /etc/apache2/apache2.conf

and edit the file & change to

AllowOverride All

for www folder

Step 4 :

Enabled apache mod rewrite (Command)

sudo a2enmod rewrite

Step 5 :

Restart Apache (Command)

sudo /etc/init.d/apache2 restart


Posted on Leave a comment

Angular.js How to remove hash from url?



.htaccess file in root directory:

RewriteEngine On 
 # If an existing asset or directory is requested go to it as it is
 RewriteRule ^ - [L]

 # If the requested resource doesn't exist, use index.html
 RewriteRule ^ /index.html

In this mode you can use links without the # in HTML files

<a href="/path">link</a>

Link in Browser: