× NETGEAR will be terminating ReadyCLOUD service by July 1st, 2023. For more details click here.
Orbi WiFi 7 RBE973
Reply

Re: Enabling .htaccess

jasonhollett
Guide

Enabling .htaccess

Hi,

I've been trying to get .htaccess files working on my ReadyNAS, but Apache doesn't seem to be setup to do this by default. A .htaccess file on my server with just "RewriteEngine on" causes a 403 Forbidden error. From my googling, I've seen lots of references to adding "AllowOverride All" and "Options +FollowSymLinks" in the httpd.conf file, but I haven't had any luck so far.

Anyone have any ideas? Thanks!
Message 1 of 20
dbott67
Guide

Re: Enabling .htaccess

I've fiddled with .htaccess in response to another post, but have not otherwise used it.

viewtopic.php?f=17&t=17846&p=96678#p96678

One of the key issues for .htaccess usage is making sure that the ownership of the file is set correctly (as noted in step #6).

-Dave
Message 2 of 20
jasonhollett
Guide

Re: Enabling .htaccess

Thanks Dave,

I gave that a try, but the ownership is already set to nogroup so I believe the problem is somewhere in the Apache config. Anything I put in the .htaccess file just gets ignored.
Message 3 of 20
jasonhollett
Guide

Re: Enabling .htaccess

I finally got this working after, thank you apache error log.

The problem was that the web share only had "Options Indexes" in the apache config file. It needed to be set to "Options All" for .htaccess to work. Though the block of code that needed to be edited wasn't in httpd.conf, it was in Shares.conf which was being called though an include in httpd.conf. The apache config files are found in /etc/frontview/apache.

Just thought I would share that for anyone else who has this issue seeing the ReadyNAS doesn't support .htaccess out of the box. At least not ours anyway.
Message 4 of 20
tcblack
Aspirant

Re: Enabling .htaccess

any potential pitfalls caused by changing this? I'm not an apache nut. :roll:

On the upside Drupal is working. 😎
Message 5 of 20
jasonhollett
Guide

Re: Enabling .htaccess

None that I know of, my ReadyNAS has been working without any problems.
Message 6 of 20
tcblack
Aspirant

Re: Enabling .htaccess

Strange, but I changed it twice and it has actually reverted after a reboot!

Third time's a charm and it stuck. Any ideas why?
Message 7 of 20
tcblack
Aspirant

Re: Enabling .htaccess

Now I'm buffaloed. The shares.conf file is NOT staying edited. Whenever I reboot it reverts back to Options Indexes.

I'm using firmware beta t120
Message 8 of 20
dbott67
Guide

Re: Enabling .htaccess

tcblack wrote:
Now I'm buffaloed. The shares.conf file is NOT staying edited. Whenever I reboot it reverts back to Options Indexes.

I'm using firmware beta t120


I seem to recall this being an issue with a number of system files that were overwritten during reboots. You can use the following command to make the file immutable:

chattr +i /path/to/file


To unset the file:
chattr -i /path/to/file


If you search the forums for 'chattr', you'll find threads related to your issue, but some of them are still out in the ether thanks to the server crash.

-Dave
Message 9 of 20
tcblack
Aspirant

Re: Enabling .htaccess

Thanks Dave!
I'll do some reading on Chattr. That did the trick of course. While I'm far from a Linux guru, I've never heard of chattr. I'll do some reading.
Message 10 of 20
cdeel
Aspirant

Re: Enabling .htaccess

Just for future reference...
I seem to have beaten this by writing my own .conf file (called AjaXplorer.conf in this case) and then added an additional Include directive in httpd.conf (below the Include for Shares.conf).

I noticed that Shares.conf seems to always get overwritten at each reboot, however httpd.conf does not get overwritten (probably the reason for separating them in the first place!)

My special .conf file contains the same lines as the relevant portion of Shares.conf, but with Options Indexes changed to Options -Indexes.

Trying to browse the directories now gives a 403 Forbidden message, which is what I wanted.

My solution seems to have survived a reboot.
Message 11 of 20
tcblack
Aspirant

Re: Enabling .htaccess

That certainly provides the added benefit of not worrying about forgetting to chattr when you do a system upgrade. I wonder if an addin could automate this.....
Message 12 of 20
super_poussin
Virtuoso

Re: Enabling .htaccess

for me everything in /etc/frontview/apache/addons/ will not be overwritten by firmware upgrade so if you put you conf file in this directory it should be ok 🙂

dont know is file in this directory are read in [A-Z] order so call it zzzzzz.conf 😛
Message 13 of 20
wuhqureshi
Aspirant

Re: Enabling .htaccess

Hi all, I've been having the same problem as the first post in this thread. I believe I have followed the subsequent advice but I am getting nowhere.

I am basically trying to setup a virtual host, and have created a share for this called /gbdev

I have created an individual conf file for this and placed it within the /etc/frontview/apache/addons directory

The contents of which are:

<VirtualHost *:80>
ServerName <sub_domain+my_domain_here>
SSLEngine off

DocumentRoot /gbdev

<Directory />
Options All
AllowOverride All
Order allow,deny
Allow from all
</Directory>
</VirtualHost>


The site works fine as long as I don't have "RewriteEngine on" in the .htaccess file. As soon as I turn it on I get a 403 Fobidden error. The following appears in the apache error log:

[error] [client <my_ip>] Options FollowSymLinks or SymLinksIfOwnerMatch is off which implies that RewriteRule directive is forbidden: /gbdev/


Firstly, to even get this close to working I had to comment out the existing VirtualHost in the /etc/frontview/apache/Virtual.conf file otherwise I would get redirected to the /shares folder everytime I accessed the domain... not helpful. This may be where I started to go wrong but it doesn't seem to be the problem to me.

I also checked the /etc/frontview/apache/Shares.conf file but found mine is empty... So surely nothing is being overridden?

Right now I'd appreaciate a little help/advice and would be happy to provide more info if needed.

Thanks in advance,
Wazz
Message 14 of 20
MWessman
Aspirant

Re: Enabling .htaccess

I read the posts regarding redirecting http requests on ReadyNAS. I'm trying to do something similar, I want to redirect http requests to https. Specifically requests to my share /webroot, /web and /media.

Question: where should I create the .htaccess file? In the root of each share, or somewhere else? All my shares are listed in Shares.conf (where I will set Options All instead of Options Indexes). I have found general examples on how to redirect from http to https, so what is missing is where to put that code, where do I create .htaccess?
Message 15 of 20
mfe_
Tutor

Re: Enabling .htaccess

Hello,

i found the solution on this site: http://www.get-the-solution.net/index-1 ... S---R.html
Its in german but i try to translate it:

Alias /www /c/www

<Location "/www">
Options Indexes FollowSymLinks SymLinksIfOwnerMatch
Order allow,deny
Allow from all
</Location>


You have to copy this code into /etc/frontview/apache/httpd.conf

/www is used in this example as webfolder where all webpages are stored in. So you have to adjust the code to your webfolder. Thats it. Have fun.

greetings
Message 16 of 20
dthrevan
Aspirant

Re: Enabling .htaccess

Hey guys,

I'm currently hosting wordpress on my ReadyNas Duo and the performance is terrible. I'm trying to install the super cache plugin however it requires permalinks to be active however after enabling this I get 403 errors and can't access it.

I'm about to add the below to but I'm not sure how to change the following. The location of wordpress on the NAS is /c/website/test.

Would the following be correct?

Alias /website/test /c/website/test

<Location "/website/test">
Options Indexes FollowSymLinks SymLinksIfOwnerMatch
Order allow,deny
Allow from all
</Location>


Any advice would be greatly appreciated 😄
Message 17 of 20
dthrevan
Aspirant

Re: Enabling .htaccess

Hey,

I have come back to this a year later as I gave up on it.

Is anyone able to assist with the above as it doesn't appear to have worked.
Message 18 of 20
mfe_
Tutor

Re: Enabling .htaccess

You can call the location from the config above with http://youripadress/website/test

Maybe you also want check also the other configs in /etc/frontview/apache/addons/.
Message 19 of 20
WhoCares_
Mentor

Re: Enabling .htaccess

dthrevan wrote:
Alias /website/test /c/website/test

<Location "/website/test">
Options Indexes FollowSymLinks SymLinksIfOwnerMatch
Order allow,deny
Allow from all
</Location>


This looks almost correct but you may need to add a '+' sign in front of Indexes, FollowSymLinks and SymLinksIfOwnerMatch. Not sure about the correct syntax in a Location block but iirc you also need an "AllowOverride FileInfo" statement in there. Also, if you only want to enable .htaccess processing, you may only need the +FollowSymLinks option.

-Stefan
Message 20 of 20
Top Contributors
Discussion stats
  • 19 replies
  • 8154 views
  • 3 kudos
  • 10 in conversation
Announcements