Create .htaccess-restricted folder in website

Hi all,
I like to protect a folder within my main webroot (var/www/html/protected) using .htaccess and htpasswd files.
However, just creating these files isn’t enough; apache config must be edited as well.
But there is no web-module to set preferences for your apache (why is that?)
And just edit /etc/httpd/conf/httpd.conf isn’t the way to go, I learned.

So my specific questions are:

  • how do I recognise a directly editable config-file from a configfile that should be edited using the e-smith templates?
  • what template or configfile can i safely edit to create the protected folder?

PS: searching the forum I saw some related topics, however they were on shared windows-folders on NS6.

Templates usually are recognizable by their disclaimer header

# ================= DO NOT MODIFY THIS FILE =================
# 
# Manual changes will be lost when this file is regenerated.
#
# ...

To be sure, launch a find /etc/e-smith/templates | grep -F <path to test>.

No e-smith templates needed for httpd on ns7. Apache configuration includes any *.conf file under /etc/httpd/conf.d, just drop your .conf file there, as you would do with CentOS.

1 Like

Thanks, I’ll go on like so then!

Have you checked Allow .htaccess and write permissions overrides in the Web access tab of the shared folder?

It’s a ns6 option. On ns7 it does not exist any more.

thank you.
Shall I write a small howto for this? Or should NS-users use one of the quaziljon how-to’s already on the internet?

2 Likes

A short Howto is always a bonus! Feel free to share what you achieved

Took some days to find time, but know I’ve jotted it down:

My first howto, please comment if necessary.
(However I’m abroad starting tomorrow, so it will take some days to react…)