Ask Ubuntu is a question and answer site for Ubuntu users and developers. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

For some reason I can't get mod_rewrite to work. I have it enabled and it is visible under phpinfo() and I have the appropriate permissions enabled. What's going on?


<VirtualHost *:80>

    ServerAdmin ****

    ServerName ****.com

    DocumentRoot /var/www

    <Directory />
        Options FollowSymLinks
        AllowOverride All

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

    ScriptAlias /cgi-bin/ /usr/lib/cgi-bin/
    <Directory "/usr/lib/cgi-bin">
        AllowOverride All
        Options +ExecCGI -MultiViews +SymLinksIfOwnerMatch
        Order allow,deny
        Allow from all

    ErrorLog ${APACHE_LOG_DIR}/error.log

    # Possible values include: debug, info, notice, warn, error, crit,
    # alert, emerg.
    LogLevel warn

    CustomLog ${APACHE_LOG_DIR}/access.log combined

    Alias /doc/ "/usr/share/doc/"
    <Directory "/usr/share/doc/">
        Options Indexes MultiViews FollowSymLinks
        AllowOverride All
        Order deny,allow
        Deny from all
        Allow from ::1/128


Here is my rewrite rule for checking...

RewriteEngine on
RewriteRule ^index.php?act=(.*)&p=(.*)$ site/$1/$2.html

Can anyone spot anything out of the ordinary?

share|improve this question
up vote 2 down vote accepted

One thing you didn't mention was the module in /etc/apache2/mods-available/rewrite.load, which enables the rewrite engine. If you haven't done this, you need to add a link in the directory /etc/apache2/mods-enabled; from the directory /etc/apache2/mods-enabled, enter ln -s ../mods-available/rewrite.load to create a symbolic link to this.

You can also use 'sudo a2enmod rewrite'

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.