Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

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?

000-default:

<VirtualHost *:80>

    ServerAdmin ****@gmail.com

    ServerName ****.com

    DocumentRoot /var/www

    <Directory />
        Options FollowSymLinks
        AllowOverride All
    </Directory>

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

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

    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 127.0.0.0/255.0.0.0 ::1/128
    </Directory>

</VirtualHost>

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

1 Answer 1

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

 
discard

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.