Re: newbie: problem with .htaccess

Giganews Newsgroups
Subject: Re: newbie: problem with .htaccess
Posted by:  Álvaro_G._Vicario
Date: Tue, 29 Sep 2009

Jivanmukta escribió:
> I have little experience with Apache.

It's alright. We'll try to clarify some concepts.

> I want to use SSL for C:\Program Files\Apache Software Foundation
> \Apache2.2\htdocs
ieruchomosci-ogloszenia\secure folder. I created
> denial.html page in this folder and .htpass file.

Encrypting (SSL) is not the same as password-protecting (AuthUserFile).
If you need both, try to fix one at a time.

> In .htaccess I have such lines:
>
> ErrorDocument 401 htdocs/nieruchomosci-ogloszenia/secure/denial.html
> AuthUserFile htdocs/nieruchomosci-ogloszenia/secure/.htpass
>
> Now I can log on with data from .htpass.
> The problem #1 is that I don't understand why I had to enter "htdocs"
> before /nieruchomosci-ogloszenia/secure/.htpass.html. Without this I
> could not receive login dialog.

"The AuthUserFile directive sets the name of a textual file containing
the list of users and passwords for user authentication. File-path is
the path to the user file. If it is not absolute, it is treated as
relative to the ServerRoot."

http://httpd.apache.org/docs/2.2/en/mod/mod_authn_file.html#authuserfile

So it looks like your DocumentRoot directive is set to "C:\Program
Files\Apache Software Foundation\Apache2.2\htdocs". Which is a weird
setting, by the way.

> The problem #2 is that when I press ESC in login dialog I can see
>
> htdocs/nieruchomosci-ogloszenia/secure/denial.html
>
> path as text in the browser instead of redirection.

"In the event of a problem or error, Apache can be configured to do one
of four things,

    1. output a simple hardcoded error message
    2. output a customized message
    3. redirect to a local URL-path to handle the problem/error
    4. redirect to an external URL to handle the problem/error
[...]

URLs can begin with a slash (/) for local web-paths (relative to the
DocumentRoot), or be a full URL which the client can resolve.
Alternatively, a message can be provided to be displayed by the browser"

http://httpd.apache.org/docs/2.2/en/mod/core.html#errordocument

The string "htdocs/nieruchomosci-ogloszenia/secure/denial.html" only
matches option number 1. You probably mean:

/htdocs/nieruchomosci-ogloszenia/secure/denial.html

--
--http://alvaro.es - Álvaro G. Vicario - Burgos, Spain
-- Mi sitio sobre programación web:http://borrame.com
-- Mi web de humor satinado:http://www.demogracia.com
--

Replies

None

In response to

newbie: problem with .htaccess posted by Jivanmukta on Tue, 29 Sep 2009