0

i have tried to setup an htaccess protection of an file from my website.

i have pasted the following code into the 05-auth.conf

$HTTP["url"] =~ "^/www/hosts/domain" {
auth.backend = "htpasswd"
auth.backend.htpasswd.userfile = "/etc/lighttpd/htpasswd"
auth.require = ( "/file.php" =>
    (
    "method"  => "basic",
    "realm"   => "Please enter your Password.",
    "require" => "valid-user"
    ),
)
}

.. and after an restart of lighttpd, i can't see any login window. What's wrong on this configuration?

2 Answers 2

1
  • "^/www/hosts/domain" looks like a filesystem path on your server, not an url
  • It looks like you want to protect http://yourserver/file.php - in that case just remove the url conditional.
  • Test with curl. Browsers usually cache responses (force reload may work too).
1

Are you sure the file /file.php is matched ? Could you try removing the / if you're not in the root directory ?

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .