0
Invalid command 'RewriteEngine', perhaps misspelled or defined by a module not included in the server configuration
Invalid command 'RewriteCond', perhaps misspelled or defined by a module not included in the server configuration

i ran a2enmod rewrite, it says "mod already enabled"

Now i get

RewriteEngine not allowed here

2 Answers 2

3

If you have your rules in a .htaccess file, then the reason for the not allowed here is almost certainly the AllowOverride setting is too restrictive. Generally it is set by default to allow very little. In your site's configuration in /etc/apache2/sites-available/foobar, add this, adjusting the directory path of course:

<Directory /var/www/mydirectory>
    AllowOverride +FileInfo
</Directory>
0

Restart Apache, perhaps? If you're trying to do this in a .htaccess file. Certainly, "Invalid command 'RewriteEngine'" indicates that mod_rewrite is not enabled, regardless of what a2enmod might say on the matter. Perhaps make sure that /etc/apache2/mods-enabled/rewrite.load has sensible-looking contents, in case something went a bit spare in there.

2
  • now i am getting RewriteEngine not allowed here
    – hwohgo
    Oct 23, 2009 at 4:26
  • What is the difference between "Now" and "Then"? If you are doing this in a htaccess, yes, you don't use RewriteEngine On, you just define your rewrite rules.
    – womble
    Oct 23, 2009 at 4:36

You must log in to answer this question.