Apache2 mod_rewrite won't work
conf file:
<VirtualHost *:27010>
DocumentRoot /var/www/test/public_html
<Directory /vaw/www/test/public_html>
AllowOverride ALL
</Directory>
</VirtualHost>
ports:
Listen 27010
/var/www/test/public_html/.htaccess
:
RewriteEngine on
gives error:
/var/www/test/public_html/.htaccess: RewriteEngine not allowed here
Please help. Tried restarting, tried a2ensite, a2enmod
You're writing AllowOverride ALL
. It should be AllowOverride All
.
From the documentation:
Directives in the configuration files are case-insensitive, but arguments to directives are often case sensitive.
As a rule, you should always follow the case used in the documentation.
Also, you can always test your apache configuration by running apachectl -t
. It should catch any syntactical errors.
<VirtualHost *:27010>
DocumentRoot /var/www/test/public_html
<Directory /vaw/www/test/public_html>
AllowOverride All
Order allow,deny
Allow from all
</Directory>
</VirtualHost>
You might find this article helpful: https://httpd.apache.org/docs/2.4/howto/htaccess.html
The "Allow" Directive is pre-2.4 though. If you have apache 2.4 you should look at the "Require" directive https://httpd.apache.org/docs/2.4/mod/mod_authz_core.html#require