RSS

Error 500 and 404 when using .htaccess for removing index.php

19 May

By: Sochinda

Enable mod_rewrite in apache

  1. Enable ReWrite mode in Apache2
    $ sudo a2enmod rewrite
    $ sudo service apache2 restart
  2. Edit site-enable configuration
    <Directory /var/www/>
        Options Indexes FollowSymLinks MultiViews
        AllowOverride all
        Order allow,deny
        allow from all
    </Directory>
    
  3. Add .htaccess
    Options +FollowSymLinks
    IndexIgnore */*
    
    <IfModule mod_rewrite.c>
     RewriteEngine on
    
     #RewriteBase /
    
     RewriteCond %{REQUEST_FILENAME} !-f
     RewriteCond %{REQUEST_FILENAME} !-d
    
     RewriteRule ^(.*)\?*$ index.php/$1 [L,QSA]
    
    </IfModule>
  4. Restart Apache2 Service
Advertisements
 
Leave a comment

Posted by on May 19, 2015 in Apache2, Yii

 

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

 
%d bloggers like this: