Rough Book

random musings of just another computer nerd

Apache2 and .htaccess with mod_rewrite on Ubuntu 8.04 (Hardy Heron)

Apparently the default settings for .htaccess files and URL rewrites in Ubuntu (8.04 anyway) is kinda jacked. Apache wasn’t seeing my .htaccess files, and even after setting up the configuration correctly, I was getting Internal Server (500) errors from .htaccess files.

The default setting for Apache2 on Ubuntu for .htaccess is “ignore it”. You need to enable it by going to /etc/apache2/sites-available/default and changing the AllowOverride directive, which you can find inside the <Directory> … </Directory> tags:

AllowOverride ALL

If you want to enable URL rewrites, you need to enable the mod_rewrite module as it is not enabled by default:

[11:31:14] vivin@dauntless ~/Projects/www/skyblue
$ sudo a2enmod rewrite
Module rewrite installed; run /etc/init.d/apache2 force-reload to enable.

[11:31:20] vivin@dauntless ~/Projects/www/skyblue
$ sudo /etc/init.d/apache2 force-reload
 * Reloading web server config apache2

Popularity: 2% [?]

March 26, 2009 - Posted by | Computers, Linux, Operating Systems | , , , , , , ,

4 Comments »

  1. Thank you – saved my day!

    ReplyReply

    Comment by bob | September 1, 2009

  2. @bob
    Glad I was able to help!

    ReplyReply

    Comment by vivin | September 9, 2009

  3. [...] Rough Book » Apache2 and .htaccess with mod_rewrite on Ubuntu 8.04 … [...]

    Pingback by Are there networking limitations with running Apache on Windows XP Professional? | Linux Backup Server | September 16, 2009

  4. Hi . hope this will help you and help every body looking for the same solution:
    u need to open appche2.conf and add the domian name like this : ServerName=’example.com’
    if you are working localhost, then ServerName=’localhost’
    and then reload the server
    :o )

    ReplyReply

    Comment by Fathi | February 25, 2010


Leave a Comment

Your email address will not be published. Required fields are marked *

*

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>

 
All original content on these pages is fingerprinted and certified by Digiprove