473,224 Members | 1,480 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,224 software developers and data experts.

scheme for access control

Hi,

Based on some info on this newsgroup, I'm trying to password protect a
directory of both PHP, HTML, and image files. The web server is Apache
2 and PHP is 4.4.4. I created this .htaccess file

RewriteCond %{REQUEST_FILENAME} -f
RewriteCond %{REQUEST_FILENAME} !^accesscontrol.php
RewriteRule ^(.*?)$ accesscontrol.php?file=$i&%{QUERY_STRING} [NC,L]

and then, just to check to make sure requests were hitting hte
accesscontrol.php file, I created accesscontrol.php to look like below
....

<?php

header('HTTP/1.0 401 Unauthorized');
exit;

?>

so theoretically, every request should result in a 401. However, when
I visit a page in the directory where this stuff is stored, I can view
the page just fine. Why is the above failing to filter my requests?

Thanks, - Dave

Oct 26 '06 #1
4 1304
Rik
la***********@zipmail.com wrote:
Hi,

Based on some info on this newsgroup, I'm trying to password protect a
directory of both PHP, HTML, and image files. The web server is
Apache 2 and PHP is 4.4.4. I created this .htaccess file

RewriteCond %{REQUEST_FILENAME} -f
RewriteCond %{REQUEST_FILENAME} !^accesscontrol.php
RewriteRule ^(.*?)$ accesscontrol.php?file=$i&%{QUERY_STRING} [NC,L]
Hey, I know that code from somewhere :-)

It works here, be sure to start you're .htaccess with:
RewriteEngine On

Ans that mod_rewrite is offcourse enabled etc.

And this:
RewriteCond %{REQUEST_FILENAME} !^accesscontrol.php
should be:
RewriteCond %{REQUEST_FILENAME} !^accesscontrol\.php
--
Rik Wasmus
Oct 26 '06 #2
You're the man, Rik. You wouldn't happen to know how to enable the
mod_rewrite module in Apache 2's httpd.conf file, would you?

Thanks, - Dave

Rik wrote:
la***********@zipmail.com wrote:
Hi,

Based on some info on this newsgroup, I'm trying to password protect a
directory of both PHP, HTML, and image files. The web server is
Apache 2 and PHP is 4.4.4. I created this .htaccess file

RewriteCond %{REQUEST_FILENAME} -f
RewriteCond %{REQUEST_FILENAME} !^accesscontrol.php
RewriteRule ^(.*?)$ accesscontrol.php?file=$i&%{QUERY_STRING} [NC,L]

Hey, I know that code from somewhere :-)

It works here, be sure to start you're .htaccess with:
RewriteEngine On

Ans that mod_rewrite is offcourse enabled etc.

And this:
RewriteCond %{REQUEST_FILENAME} !^accesscontrol.php
should be:
RewriteCond %{REQUEST_FILENAME} !^accesscontrol\.php
--
Rik Wasmus
Oct 26 '06 #3
Rik
la***********@zipmail.com wrote:
You're the man, Rik. You wouldn't happen to know how to enable the
mod_rewrite module in Apache 2's httpd.conf file, would you?
Normally it's there, just remove the ';' in front of it.
--
Rik Wasmus
Oct 26 '06 #4
Rik wrote:
la***********@zipmail.com wrote:
>Hi,

Based on some info on this newsgroup, I'm trying to password protect a
directory of both PHP, HTML, and image files. The web server is
Apache 2 and PHP is 4.4.4. I created this .htaccess file

RewriteCond %{REQUEST_FILENAME} -f
RewriteCond %{REQUEST_FILENAME} !^accesscontrol.php
RewriteRule ^(.*?)$ accesscontrol.php?file=$i&%{QUERY_STRING} [NC,L]

Hey, I know that code from somewhere :-)

It works here, be sure to start you're .htaccess with:
RewriteEngine On

Ans that mod_rewrite is offcourse enabled etc.

And this:
RewriteCond %{REQUEST_FILENAME} !^accesscontrol.php
should be:
RewriteCond %{REQUEST_FILENAME} !^accesscontrol\.php
This looks to me like a much more complicated solution than using
mod_auth_external.

Colin
Oct 29 '06 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

699
by: mike420 | last post by:
I think everyone who used Python will agree that its syntax is the best thing going for it. It is very readable and easy for everyone to learn. But, Python does not a have very good macro...
0
by: Philippe Poulard | last post by:
I don't know if anybody already designed an URN scheme for XML; here is a proposal: I call it the "XML URN Scheme", or XUS. ========= URNs are logical names used to identify resources. XUS...
6
by: James Owens | last post by:
I maintain a small web page for internal company use. People access it by typing "library" in their browser address bar; this defaults to "http://library" which the network admin magically...
16
by: Patty O'Dors | last post by:
In my quest to create a derived edit control in ATL that will go into an application that will hopefully make me some money one day, I have decided to try to devise a custom licensing scheme for...
1
by: rdemyan via AccessMonster.com | last post by:
I'm trying to implement a licensing scheme. There are three types of licenses: Trial - good for 30 to 60 days Interim - good for 1 year Fully Paid - no expiration Everything is working fine...
1
by: Robby Findler | last post by:
Dear all, I'm writing to let you know about the upcoming Scheme and Functional Programming workshop -- specifically that the submission deadline is June 9, about 2 months from now. The workshop...
7
by: laredotornado | last post by:
Hello, I'm using PHP 4.4.4 with MySQL 5.0. I have a USERS table wher I store a username and password for each user. I have a directory (containing both HTML and PHP files) that I would like...
0
by: gsxr1100 | last post by:
Hi, I've having some baffling problems with a java applicaiton! I have an application server called WA01 which used to access two tables on an MS SQL 2000 server via a scheme login. The two...
3
by: mzarlenga | last post by:
I have a client / server written in C#/VS2005 that uses WCF. Each component exposes a secure (https:) endpoint with WCF. httpcfg was used to secure the ports with certificates. (Both system use the...
1
isladogs
by: isladogs | last post by:
The next online meeting of the Access Europe User Group will be on Wednesday 6 Dec 2023 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, Mike...
0
by: VivesProcSPL | last post by:
Obviously, one of the original purposes of SQL is to make data query processing easy. The language uses many English-like terms and syntax in an effort to make it easy to learn, particularly for...
3
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 3 Jan 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). For other local times, please check World Time Buddy In...
0
by: jianzs | last post by:
Introduction Cloud-native applications are conventionally identified as those designed and nurtured on cloud infrastructure. Such applications, rooted in cloud technologies, skillfully benefit from...
0
by: mar23 | last post by:
Here's the situation. I have a form called frmDiceInventory with subform called subfrmDice. The subform's control source is linked to a query called qryDiceInventory. I've been trying to pick up the...
0
by: abbasky | last post by:
### Vandf component communication method one: data sharing ​ Vandf components can achieve data exchange through data sharing, state sharing, events, and other methods. Vandf's data exchange method...
2
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 7 Feb 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:30 (7.30PM). In this month's session, the creator of the excellent VBE...
0
by: stefan129 | last post by:
Hey forum members, I'm exploring options for SSL certificates for multiple domains. Has anyone had experience with multi-domain SSL certificates? Any recommendations on reliable providers or specific...
0
by: MeoLessi9 | last post by:
I have VirtualBox installed on Windows 11 and now I would like to install Kali on a virtual machine. However, on the official website, I see two options: "Installer images" and "Virtual machines"....

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.