Enabling .htaccess

A nice, warm, and cozy place for all third-party developers to congregate.

Enabling .htaccess

Postby jasonhollett » Wed Jul 16, 2008 10:58 am

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!
jasonhollett
ReadyNAS Newbie
 
Posts: 5
Joined: Wed Jul 16, 2008 10:51 am

Re: Enabling .htaccess

Postby dbott67 » Wed Jul 16, 2008 11:14 am

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
User avatar
dbott67
ReadyNAS Fanatic
 
Posts: 8523
Joined: Mon Dec 31, 2007 9:20 am
Location: District 9
ReadyNAS: Pro

Re: Enabling .htaccess

Postby jasonhollett » Wed Jul 16, 2008 11:28 am

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.
jasonhollett
ReadyNAS Newbie
 
Posts: 5
Joined: Wed Jul 16, 2008 10:51 am

Re: Enabling .htaccess

Postby jasonhollett » Thu Jul 17, 2008 7:51 am

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.
jasonhollett
ReadyNAS Newbie
 
Posts: 5
Joined: Wed Jul 16, 2008 10:51 am

Re: Enabling .htaccess

Postby tcblack » Fri Jul 25, 2008 8:58 am

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

On the upside Drupal is working. 8)
User avatar
tcblack
ReadyNAS Expert
 
Posts: 290
Joined: Fri Jul 04, 2008 7:55 am
Location: Central Illinois, USA
ReadyNAS: Duo

Re: Enabling .htaccess

Postby jasonhollett » Tue Jul 29, 2008 10:17 am

None that I know of, my ReadyNAS has been working without any problems.
jasonhollett
ReadyNAS Newbie
 
Posts: 5
Joined: Wed Jul 16, 2008 10:51 am

Re: Enabling .htaccess

Postby tcblack » Tue Jul 29, 2008 5:51 pm

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?
User avatar
tcblack
ReadyNAS Expert
 
Posts: 290
Joined: Fri Jul 04, 2008 7:55 am
Location: Central Illinois, USA
ReadyNAS: Duo

Re: Enabling .htaccess

Postby tcblack » Tue Jul 29, 2008 6:32 pm

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
User avatar
tcblack
ReadyNAS Expert
 
Posts: 290
Joined: Fri Jul 04, 2008 7:55 am
Location: Central Illinois, USA
ReadyNAS: Duo

Re: Enabling .htaccess

Postby dbott67 » Tue Jul 29, 2008 6:41 pm

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:

Code: Select all
chattr +i /path/to/file


To unset the file:
Code: Select all
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
User avatar
dbott67
ReadyNAS Fanatic
 
Posts: 8523
Joined: Mon Dec 31, 2007 9:20 am
Location: District 9
ReadyNAS: Pro

Re: Enabling .htaccess

Postby tcblack » Tue Jul 29, 2008 7:02 pm

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.
User avatar
tcblack
ReadyNAS Expert
 
Posts: 290
Joined: Fri Jul 04, 2008 7:55 am
Location: Central Illinois, USA
ReadyNAS: Duo

Re: Enabling .htaccess

Postby cdeel » Wed Sep 03, 2008 2:22 am

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.
cdeel
ReadyNAS Newbie
 
Posts: 19
Joined: Mon Jun 16, 2008 1:09 pm
Location: Eugene, Oregon, USA
ReadyNAS: X6

Re: Enabling .htaccess

Postby tcblack » Wed Sep 03, 2008 8:32 am

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.....
User avatar
tcblack
ReadyNAS Expert
 
Posts: 290
Joined: Fri Jul 04, 2008 7:55 am
Location: Central Illinois, USA
ReadyNAS: Duo

Re: Enabling .htaccess

Postby super-poussin » Wed Sep 03, 2008 12:33 pm

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 :P
If you like my add-ons - Si vous aimez mes add-ons :
Image --- -------- Image
I'm not a 6 weeks Rabbit
Where I'm teaching
User avatar
super-poussin
ReadyNAS Add-ons Expert
 
Posts: 4703
Joined: Fri Jul 13, 2007 1:16 pm
ReadyNAS: Pro

Re: Enabling .htaccess

Postby wuhqureshi » Sun Sep 07, 2008 9:01 am

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:

Code: Select all
<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:

Code: Select all
[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
wuhqureshi
ReadyNAS Newbie
 
Posts: 1
Joined: Sun Sep 07, 2008 8:18 am

Re: Enabling .htaccess

Postby MWessman » Mon Jan 18, 2010 7:32 am

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?
MWessman
ReadyNAS Newbie
 
Posts: 23
Joined: Wed Jan 06, 2010 3:24 pm
ReadyNAS: Duo

Next

Return to ReadyNAS Developers Network



Who is online

Users browsing this forum: Daumoa [Crawler] and 1 guest