Author Topic: [Zentyal 3.4] .htaccess not being read  (Read 1454 times)

schoots

  • Zen Apprentice
  • *
  • Posts: 2
  • Karma: +0/-0
    • View Profile
[Zentyal 3.4] .htaccess not being read
« on: May 31, 2014, 06:22:38 pm »
Zentyal 3.4
Ubuntu Server 13.10
Latest Updates as of Today 5/31/14

I've searched the forums and it doesn't seem like this has been answered.

I am aware this can be done in the Virtual hosts section in Zentyal Admin, but I would prefer doing this through .htaccess

I have a new install of Zentyal and would like to add a .htaccess file to the root of my web server so that when I navigate to a subdomain it redirects to https:
Code: [Select]
RewriteEngine On
RewriteCond %{HTTPS} off
RewriteCond %{HTTP_HOST} ^(sub1|sub2|sub3)\. [NC]
RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI} [R,L]

To test that the .htaccess was working I added:
Code: [Select]
deny from all
It doesn't show the error, so I went into the apache2.conf and noticed that the webroot looks like this:
Code: [Select]
<Directory /var/www/>
Options Indexes FollowSymLinks
AllowOverride none
Require all granted
</Directory>

I changed AllowOverride to 'All' and restarted apache and that gives me a 500 error.


Anyone else had this problem? Or ideas on how to fix it?
« Last Edit: May 31, 2014, 08:24:28 pm by schoots »

schoots

  • Zen Apprentice
  • *
  • Posts: 2
  • Karma: +0/-0
    • View Profile
Re: [Zentyal 3.4] .htaccess not being read
« Reply #1 on: June 05, 2014, 06:07:04 am »
In the future, for anyone who sees this:

Zentyal uses Stubs to maintain it's configuration. If you add the <Directory> configuration to the default.conf.mas you'll be able to have access.

Here's the code, it's easiest to just do this in SU:
Code: [Select]
cd /usr/share/zentyal/stubs/webserver
Code: [Select]
cp default.conf.mas default.conf.mas.bak
At the bottom you can add your directory code, in my case this was:
Code: [Select]
<Directory /var/www>
Options Indexes FollowSymLinks
AllowOverride All
Require all granted
</Directory>

Hope this helps someone in the future!