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, 24677 views
Visitor's picture
asked by Visitor
2 years 13 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
2 years 13 weeks ago
  • Thanks a lot, that was it.

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

    - lightnin 1 year 36 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
    2 years 13 weeks ago
  • Thank you, It worked for me o/

    - Visitor 3 weeks 22 hours 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
    2 years 13 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 27 weeks 4 days 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 2 years 10 weeks ago
  • Ubuntu 11.04 released!

    Ubuntu 11.04 code named natty narwhal is released download ubuntu 11.04

    Read ubuntu 11.10 reviews and share yours now!!

    View in your own language!

    Stay Connected

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

    Poll

    Favorite desktop environment?: