Page 1 of 1
using .htaccess files
Posted: 09 Apr 2012, 12:16
by toukie
I would like to use .htaccess for different things like custom error pages and maybe for banning some IP's.
I have changed "AllowOverride None" to "AllowOverride All" in /etc/apache2/sites-enabled/bubba, and I have a .htaccess file in /home/web and a custom "error404.htm" page in folder: /home/web/errordocs. Why doesn't Apache pick it up?
/etc/apache2/httpd.conf has: "AccesFileName .htaccess"
How do I enable .htaccess on B3?
Re: using .htaccess files
Posted: 10 Apr 2012, 09:43
by Kiff
Have you restarted apache after you changed "AllowOverride"?
Re: using .htaccess files
Posted: 10 Apr 2012, 11:00
by toukie
I have restarted several times, what else could it be?
I want to use .htaccess to make a nice custom 404-error page with Troll Face and the word "problem?" for all those who are looking for phpMyAdmin on my server (I didn't install it, it seems to be a security risk)
Re: using .htaccess files
Posted: 10 Apr 2012, 13:48
by nobody
try to see if your htaccess is read by apache by entering a typo in it and reloading apache. Then look in the error logs if apache complains.
As many directives in apache can be applied from different angles (location, virtualhost, directory) this is the quickest way to see if the htaccess is used

Re: using .htaccess files
Posted: 21 Apr 2012, 13:38
by toukie
still no joy with .htaccess files, but I found out that custom error-pages are done with
/etc/apache2/conf.d/localized-error-pages. My custom 404-error page is now a really nice one!
OwnCloud uses .htaccess, so it would be good to know how to enable it. I don't know, maybe Apache rewrites the AllowOverride at reboot, mine was anyway back to "None" when I checked.
Re: using .htaccess files
Posted: 21 Apr 2012, 15:12
by Ubi
toukie wrote:I don't know, maybe Apache rewrites the AllowOverride at reboot, mine was anyway back to "None" when I checked.
It most certainly does not do that

. Most likely the position you put your directive is ignored or overruled by another directive,
Re: using .htaccess files
Posted: 21 Apr 2012, 15:28
by toukie
"It most certainly does not do that".
In that case it would be nice to know where those overruling directives are found.
Re: using .htaccess files
Posted: 21 Apr 2012, 15:43
by Ubi
Yeah I know, and if I would know I'd have told you. Searching for the winning rule can be a pain, and I cannot give you an easy answer except that there is no resetting done by apache at boot time.
Re: using .htaccess files
Posted: 21 Apr 2012, 15:56
by toukie
Apache says that you are not supposed to do things with .htaccess.
https://httpd.apache.org/docs/current/h ... ccess.html
"However, in general, use of .htaccess files should be avoided when possible. Any configuration that you would consider putting in a .htaccess file, can just as effectively be made in a <Directory> section in your main server configuration file."
OwnCloud uses .htaccess: "If you are running the apache webserver, it is recommended that you enable .htaccess files as ownCloud uses them to enhance security and allows you to use webfinger."
Re: using .htaccess files
Posted: 22 Apr 2012, 03:15
by nobody
Well of course, that would be because owncloud does not allow you access to their main server config. Allowing modifications via htaccess is the next best thing.
However, on the B3 you are the admin and you do have access to the main config. In that case, placing directives in the main config is preferred, not in the least because these directives are not processed after every http request.