How to fix "the .htaccess file does not work" message

Here we try to answer typical questions
Forum rules
The forums were migrated over to https://central.owncloud.org which is based on the forum software Discourse. The forums here is put into read-only mode starting from today.

More background information about this move and the reasoning behind it is available in this blogpost:

https://daniel.molkentin.net/2016/07/20 ... d-central/
RealRancor
ownCloud master
Posts: 17381
Joined: Sat May 26, 2012 3:00 pm
ownCloud version: 9.0.2
Webserver: nginx
Database: MySQL
OS: Linux
PHP version: 7.0.x

How to fix "the .htaccess file does not work" message

Postby RealRancor » Tue Jul 01, 2014 8:08 pm

Problem:
One of the following message is showing up during setup or within your admin control panel:

Your data directory and files are probably accessible from the internet because the .htaccess file does not work.
For information how to properly configure your server, please see the documentation.


Ihr Datenverzeichnis und Ihre Dateien sind wahrscheinlich vom Internet aus erreichbar, weil die .htaccess-Datei nicht funktioniert.
Bitte lesen Sie die Dokumentation, um zu erfahren, wie Sie Ihren Server richtig konfigurieren können.


Solution:
A generic solution is to move your data directory out of the web accessible directory like described in this FAQ:

viewtopic.php?f=17&t=7118

If you don't want to move your data directory first make sure that no:

/var/www/owncloud/data/htaccesstest.txt (replace the path with your current path)

exists which could fail this test.

Apache
First make sure that the .htaccess file located at:

/var/www/owncloud/data/.htaccess (or the location where you have installed ownCloud)

exists, is readable by the user running your webserver (mostly www-data) and contains the following:

Code: Select all

deny from all
IndexIgnore *


The second step is to configure your webserver to parse .htaccess files. This can be achieved with the config directive "AllowOverride All" in your vhost configuration (If there is already an "AllowOverride None" configured you need to replace it).

On various distros you need to edit the /etc/apache2/apache2.conf directly and replace the "AllowOverride None" with "AllowOverride All".

After doing this step please make sure that you restart your Webserver!!!

An example of such a vhost configuration is provided in the official documentation located here:

http://doc.owncloud.org/server/6.0/admi ... figuration

NginX
When using NginX you need to make sure that you're running the config provided at the official documentation:

http://doc.owncloud.org/server/6.0/admi ... figuration

Especially this part of the config is needed to protect your data directory:

Code: Select all

        location ~ ^/(data|config|\.ht|db_structure\.xml|README) {
                deny all;
        }


Lighttpd
No idea, infos are welcome.
*gone*

NatanV
Newbie
Posts: 5
Joined: Wed Jul 23, 2014 7:21 am
ownCloud version: 6.0.4
Webserver: Apache
Database: MySQL
OS: Windows Server
Location: Valencia - Spain
Contact:

Re: How to fix "the .htaccess file does not work" message

Postby NatanV » Wed Jul 23, 2014 12:41 pm

Nice data, thanks!
Official Staff from DatosAlCubo.com, we care about your data. Alquila nuestro espacio y olvídate de problemas técnicos.
Hablo español. I speak English.

User avatar
finius
Starter
Posts: 95
Joined: Thu Jul 18, 2013 10:32 am
ownCloud version: 8.0.2
Webserver: Apache
Database: MySQL
OS: Linux
PHP version: Ubuntu 14.04 BuildIn
Location: Frankfurt / Main

Re: How to fix "the .htaccess file does not work" message

Postby finius » Fri Apr 24, 2015 1:35 pm

hm, sorry, i get an ...

Code: Select all

Forbidden
You don't have permission to access / on this server.
--------------------------------------------------------------------------------
Apache/2.4.7 (Ubuntu) Server at cloud.finius-group.net Port 443


... when placing ...

Code: Select all

deny from all
IndexIgnore *


... into .htaccess
.htaccess got the correct rights and apache.conf is as follows:

Code: Select all

<Directory /var/www/owncloud/ >
   Options Indexes SymLinksIfOwnerMatch
   AllowOverride All
   Require all granted
</Directory>
"Der Anfang jeder Katastrophe ist ne beschissene Vermutung!"

RealRancor
ownCloud master
Posts: 17381
Joined: Sat May 26, 2012 3:00 pm
ownCloud version: 9.0.2
Webserver: nginx
Database: MySQL
OS: Linux
PHP version: 7.0.x

Re: How to fix "the .htaccess file does not work" message

Postby RealRancor » Fri Apr 24, 2015 1:45 pm

Hi,

if you're placing this into your /var/www/owncloud/.htaccess file its normal that you're getting this message as it "deny from all" denies all access. This needs to be entered into your /var/www/owncloud/data/.htaccess
*gone*

User avatar
finius
Starter
Posts: 95
Joined: Thu Jul 18, 2013 10:32 am
ownCloud version: 8.0.2
Webserver: Apache
Database: MySQL
OS: Linux
PHP version: Ubuntu 14.04 BuildIn
Location: Frankfurt / Main

Re: How to fix "the .htaccess file does not work" message

Postby finius » Fri Apr 24, 2015 2:02 pm

Ok, that's already been done. My data dir is mounted into some root directory, outside the webserver folder.
However, oc8 admin page tells me, that my .htaccess doesn't work. Nevertheless I am able to edit i.e. my upload sizes though the GUI and write them into the .htaccess inside the webservers oc root dir.
So, at least, it must to be working in some particular way.
"Der Anfang jeder Katastrophe ist ne beschissene Vermutung!"


  • Similar Topics
    Replies
    Views
    Last post

Return to “FAQ”

Who is online

Users browsing this forum: No registered users and 1 guest