Figured out that my .htaccess was not working due to mod_rewrite not installed on my ubuntu desktop. How to install and enable mod_rewrite?

3 answers, votes, 112104 views
Visitor's picture
asked by Visitor
5 years 2 weeks ago



3 Answers

Answer

Open a terminal and type the following command
 
sudo a2enmod rewrite
 
This will enable rewrite module for apache

Visitor's picture
answer by Visitor
5 years 2 weeks ago
  • Thanks a lot, that was it.

    - Visitor 2 years 49 weeks ago
  • You need to restart apache afterwards:
    /etc/init.d/apache2 restart

    - lightnin 4 years 25 weeks ago
  • Answer

    Open terminal & follow this :
    #sudo gedit /etc/apache2/sites-enabled/000-defaultCheck for these lines & change as I have done here :
     DocumentRoot /var/www/        <Directory />                Options FollowSymLinks                AllowOverride all        </Directory>        <Directory /var/www/>                Options FollowSymLinks                 AllowOverride all                Order allow,deny                allow from all        </Directory>        Save the file & restart apache :
    #sudo /etc/init.d/apache2 restart

    Visitor's picture
    answer by Visitor
    5 years 2 weeks ago
  • Thank you, It worked for me o/

    - Visitor 2 years 44 weeks ago
  • Answer

    There is a Bug in apache while using a2enmod, it doesn't make any
    changes, so I am following these steps from last 1 year everytime I
    reinstall ubuntu. May be they fixed it in new version. But these steps works 100%
    Open terminal & follow this :
    #sudo gedit /etc/apache2/sites-enabled/000-default
    Check for these lines & change as I have done here : 
    DocumentRoot /var/www/        <Directory />                Options FollowSymLinks                AllowOverride all        </Directory>        <Directory /var/www/>                Options FollowSymLinks                 AllowOverride all                Order allow,deny                allow from all        </Directory> Save the file & restart apache :
    #sudo /etc/init.d/apache2 restart

    Visitor's picture
    answer by Visitor
    5 years 2 weeks ago
  • hi. I you can simple change your whole website theme through just this rewrite rule
    by this
    RewriteCond %{http_host} ^([^.]+)\.test.com [NC]
    RewriteRule ^(images|css)/(.+)$ themes/2/$1/$2 [L]
    for more info you can visit this
    http://developer99.blogspot.com/2011/07/changing-your-website-theme-thor...

    - Visitor 3 years 17 weeks ago
  • Yep, in addition to the above answer, one must add AllowOverride All to <Directory> tag in the /etc/apache2/sites-enabled/000-default file

    - Visitor 5 years 1 day ago
  • Have a question or want to discuss an idea about Chromecast? checkout chromecast forums

    Ubuntu 13.04 released!

    Ubuntu 13.04 code named Raring Ringtail is released download ubuntu 13.04. Download while it's hot!!

    View in your own language!

    Stay Connected

    Ubun2.com on Facebook Ubun2.com on Twitter RSS Feeds

    Poll

    Favorite desktop environment?: