1.Configure apache mod_rewrite,run in terminal
a2enmod rewrite
2. add the following code to /etc/apache2/sites-available/default
DocumentRoot /var/www
<Directory />
Options FollowSymLinks
AllowOverride All
</Directory>
<Directory /var/www/>
Options Indexes FollowSymLinks MultiViews
AllowOverride All
Order allow,deny
allow from all
</Directory>
3.Restart apache
/etc/init.d/apache2 restart