Showing posts with label Install apache. Show all posts

How to enable mod_rewrite in Ubuntu 14.04 and 12.04 LTS


Here I am back to guide you how to enable mod_rewrite in ubuntu 14.04 & 12.04 LTS. A little note this is the basic steps to enable mod_rewrite but not the best way. Best way is to setup virtual host first and make changes in that config.
Read my previous blog to learn How to install & configure apache in ubuntu.

Ubuntu 14.04 comes with apache 2.4 & ubuntu 12.04 comes with apache 2.2.
This new version introduced different default config file names and in general some differences.

So here are the steps to enable mod_rewrite

1. Open terminal (Shortcut ctrl+alt+t).
2. Activate mod_rewrite.

    sudo a2enmod rewrite    

3.  Restart apache.

    service apache2 restart   

4.  To use mod_rewrite from .htaccess file make some changes in virtual host config file.

if you are using ubuntu 12.04 then run

    sudo nano /etc/apache2/sites-available/default

change the line says AllowOverride from None to all. And comment ' Order allow,deny ' line with hashtag(#).

<Directory /var/www/>
       Options Indexes FollowSymLinks MultiViews
       AllowOverride All
       #Order allow,deny
       allow from all
</Directory>

Now if you are using ubuntu 14.04

sudo nano /etc/apache2/sites-available/000-default.conf

And add this line within virtual host config tag.


<Directory /var/www/>
       Options Indexes FollowSymLinks MultiViews
       AllowOverride All
       #Order allow,deny
       allow from all
</Directory>

5.  Restart apache.

    service apache2 restart  

Now you have enabled mod_rewrite successfully. Great job. :)

If you feel this is useful please keep share to your colleagues. Be social.  

 


How to install and configure Apache in Ubuntu



Install Apache

Installing apache in Ubuntu is very easy.
Here are the steps.
1. Open terminal. Use ctrl+Alt+t.
2. sudo apt-get install apache2
3. exit

Congrats! You have installed apache successfully.
Now open http://localhost in your browser. You will see "It Works!".
Configure Apache
If you want to start,stop & restart apache use this commands.
1. to start " sudo service apache2 start ".
2. To stop " sudo service apache2 stop ".
3. To restart " sudo service apache2 restart ".
 Please comment below if you face any issue.