PDA

View Full Version : .htaccess on CNC - how to re-direct user to html page?


js
03-29-2001, 01:33 AM
Does anybody know the best way to re-direct a user to an html file within a password protected directory?

I just want to make sure that only paid subscribers access the html page within the protected directory, but it seems that after entering a user name/password, the user is shown an index of files within the directory....

Any ideas on the best way to solve this, or which cgi script is the best to use? (if not using the CNC .htaccess facility)

Thanks

Maynard
03-29-2001, 09:15 AM
js,

If a directory is protected by .htaccess the user will of course be required to enter name and password. It sounds like you have that working.

If you're just linking to the directory, then .htaccess DirectoryIndex directive can be used to specify default file sequence to present (i.e. index.html).

It is my understanding that the configuration established by any .htaccess file is inherited by all subdirectories; and that .htaccess files under the parent can be used to add or subtract elements, so you don't need to keep repeating yourself in each dir.

It's pretty well documented, and searchable, here at aota.net

js
03-30-2001, 12:15 AM
Thanks Maynard,

I've checked out the aota tutorials and what is there is quite clear, however, it's not clear (at least not to me) how I'm supposed to re-direct someone to a certain html page after they provide their username/password.

The aota tutorial only mentions what to do with error documents. How to re-direct normally?

I tried disabling the directory browsing directive with an Options -Indexes, but I just get an error 403 forbidden.

Any ideas?

PaulKroll
03-30-2001, 12:23 AM
Um... like Maynard said... index.html within the protected directory. I think you're confusing redirect (which means to point someone at a different page than they asked for) with the simple index.html file (which is the default file someone gets when they hit a directory... or in the case of a protected directory, the default file they hit IF they enter username/password correctly.)

js
03-30-2001, 12:29 AM
Thanks fellas!

The file I wanted to "re-direct" to was not called index.html, hence my confusion. I just went into the CNC and renamed the file index.html and it now works fine!

Thanks for the help!

Is it necessary to also include directives for error pages in case someone types in an incorrect password?

Jeff
03-30-2001, 12:42 AM
Yes, I would.

Since it is for paid subscriptions, I would include an error page which included a friendly note stating that their username or password was incorrect or that they need to re-subscribe after their subscription has lapsed this is the case, or maybe instructions for how to retrieve or have sent their password to the email they subscribed with, etc.

ErrorDocument 401 /401.html
ErrorDocument 403 /403.html

http://www.aota.net/htaccess/index.php3

js
03-30-2001, 12:57 AM
Thanks to everybody for your help - I really appreciate your input. Keep up the great work!