0

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

MrWhite
  • 11,643
  • 4
  • 25
  • 40
Tengiz
  • 109
  • 2
  • Possible duplicate of [Redirect, Change URLs or Redirect HTTP to HTTPS in Apache - Everything You Ever Wanted to Know About Mod\_Rewrite Rules but Were Afraid to Ask](https://serverfault.com/questions/214512/redirect-change-urls-or-redirect-http-to-https-in-apache-everything-you-ever) – MadHatter Apr 03 '18 at 19:54
  • 1
    "``" - `vaw` should be `var`!? Or is that just a typo in your question? – MrWhite Apr 06 '18 at 14:50
  • 1
    @MrWhite that could be it actually, why settings wouldn't take effect – Tengiz Apr 17 '18 at 18:27

3 Answers3

1

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.

Jenny D
  • 27,358
  • 21
  • 74
  • 110
1
<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

JohnA
  • 556
  • 3
  • 12
  • Make sure also that you are not using a tag in .htaccess. – JohnA Mar 30 '18 at 21:09
  • Server version: Apache/2.4.7 (Ubuntu) – Tengiz Mar 30 '18 at 21:33
  • 1
    I installed php and it worked.... How come it didn't work without PHP ??? – Tengiz Mar 30 '18 at 21:59
  • @Tengiz The parts of the configuration that you posted do not require PHP. Therefore, the issue must lie in the parts of the config that you did not include in your question. Which means nobody can answer. – Jenny D Mar 31 '18 at 14:40
0
DocumentRoot /var/www/test/public_html
<Directory /vaw/www/test/public_html>

As noted in comments, a typo in the file-path specified in the <Directory> directive seems to have been the problem. /vaw/ should have been /var/ to match the DocumentRoot. With an incorrect file-path the <Directory> section would have simply been ignored.

MrWhite
  • 11,643
  • 4
  • 25
  • 40