You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@httpd.apache.org by Grant Cooper <gr...@nucleus.com> on 2002/09/01 21:31:50 UTC

[users@httpd] password protect a directory

This is new to me. I currently am using apache 1.3, mod_php, mod_perl. I
just installed phpMyAdmin for mysql and trying to secure it. I was told to
password protect the directory. Where should I start?


---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
   "   from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org


Re: [users@httpd] Is mod_rewrite the solution for this...?

Posted by Hans Juergen von Lengerke <le...@sixt.de>.
dale's stuff <st...@colony.net> on Sep 4, 2002:

> >   RewriteRule ^/members/(([^/]{2})[^/]*)/(.*)$ /members/$2/$1/$3
>
> If I understand this correctly, (I have never used mod_rewrite) this is
> looking in the members folder, getting the first 2 charactors after the /
> then re-writing that to /members/$2 (this is the leading 2 charactors of
> the nickname) /$1 (where this is the nickname value) and $3 ? this is
> anything after the trailing / after the nickname.
>
> Is that correct?

Yes, that is more or less correct. The pattern (the first argument to
RewriteRule) says in English:

   ^           # If a requested URL starts with
   /members/   # the string "/members/"
   (           # [start storing matches in $1]
    (          # [start storing matches in $2]
     [^/]{2}   # match two chars that aren't a "/"
    )          # [end storing matches in $2]
    [^/]*      # match any chars that aren't a "/"
   )           # [end storing matches in $1]
   /           # followed by a "/"
   (           # [start storing matches in $3]
    .*         # any number of any chars
   )           # [end storing matches in $3]
   $           # up to the end of the URL


Check out any tuturials/guides on the web on "Regular Expressions".
Another good resource is Jeffrey Friedls "Mastering Regular Expressions"
from O'Reilly.


---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
   "   from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org


Re: [users@httpd] Is mod_rewrite the solution for this...?

Posted by dale's stuff <st...@colony.net>.
Hello,

Thank you for the reply and sorry for any confusion on what I am trying to 
do.

Currently a profile link is styled as:

  domain.com/members/details.html?id=3434525252434523

I wish to change this to

  domain.com/members/nickname/

on the server the nickname directory would be stored as 
/members/ni/nickname/

The reason for this is the current 15,000 directories I need to create with 
growth expected to triple soon. I did not want that many directories all in 
one master directory. I felt that by splitting them up this way it makes it 
easier on the OS (Linux) and makes it easier if I need to place some of 
these folders on another drive.

Creating the directories is not a problem with the server side tool I am 
already using. I could serve them this was as well, but one of the other 
ideas is to cut down on the number of database queries on the server. I 
will be writing out static pages to these folders as well.


On Wednesday, September 4, 2002, at 04:53  PM, Hans Juergen von Lengerke 
wrote:

> dale's stuff <st...@colony.net> on Sep 4, 2002:
>
>> An example would be - domain.com/members/greybear/ where I think I should
>> create a folder named ./members/gr/greybear/
>
> I'm not entirely sure I understand what you want but maybe this is it:
>
>   RewriteRule ^/members/(([^/]{2})[^/]*)/(.*)$ /members/$2/$1/$3

If I understand this correctly, (I have never used mod_rewrite) this is 
looking in the members folder, getting the first 2 charactors after the / 
then re-writing that to /members/$2 (this is the leading 2 charactors of 
the nickname) /$1 (where this is the nickname value) and $3 ? this is 
anything after the trailing / after the nickname.

Is that correct?

> This will work for all users with userids of at least 2 characters
> length.
>
> Regards, Hans

Thanks

Dale


---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
   "   from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org


Re: [users@httpd] Is mod_rewrite the solution for this...?

Posted by Hans Juergen von Lengerke <le...@sixt.de>.
dale's stuff <st...@colony.net> on Sep 4, 2002:

> An example would be - domain.com/members/greybear/ where I think I should
> create a folder named ./members/gr/greybear/

I'm not entirely sure I understand what you want but maybe this is it:

  RewriteRule ^/members/(([^/]{2})[^/]*)/(.*)$ /members/$2/$1/$3

This will work for all users with userids of at least 2 characters
length.

Regards, Hans


---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
   "   from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org


[users@httpd] Is mod_rewrite the solution for this...?

Posted by dale's stuff <st...@colony.net>.
Hello,

Apache 1.3x on RH Linux 7.2

I have a website with user profile pages that are served from a database. I 
wish to change this around a bit so that instead of having a longer url 
with numbers in it the URL will be styled domain.com/members/nickname/

I am getting the member names all unique in the database, and while I could 
create directories in the members directory for each user, I currently have 
about 15,000 users and expect to grow to even higher numbers as I implement 
various improvements.

I can use my existing tool to say grab the first 1 or 2 letters of the 
nickname to create a directory under ./members/ but then I would need to 
somehow have another process on the server see the url and point to the 
proper place. I can do this with my existing server side tool, but I am 
thinking that accomplishing this in the webserver will probably be faster.

An example would be - domain.com/members/greybear/ where I think I should 
create a folder named ./members/gr/greybear/

Does the above make sense or am I looking to the wrong place to accomplish 
this?

Thanks for any suggestions.

Dale


---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
   "   from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org


Re: [users@httpd] password protect a directory

Posted by Robert <ro...@iremote.com>.
Grant:

I don't know phpMyAdmin at all, but from the little I know about it you 
would want standard HTTP basic auth to authenticate the access to a 
certain directory on the server.  You should read the docs at...

http://httpd.apache.org/docs/howto/auth.html#basic

This should tell you what you want to know.

  ~ Robert


Grant Cooper wrote:
> This is new to me. I currently am using apache 1.3, mod_php, mod_perl. I
> just installed phpMyAdmin for mysql and trying to secure it. I was told to
> password protect the directory. Where should I start?
> 
> 
> ---------------------------------------------------------------------
> The official User-To-User support forum of the Apache HTTP Server Project.
> See <URL:http://httpd.apache.org/userslist.html> for more info.
> To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
>    "   from the digest: users-digest-unsubscribe@httpd.apache.org
> For additional commands, e-mail: users-help@httpd.apache.org
> 




---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
   "   from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org


Re: [users@httpd] password protect a directory

Posted by Matthew Daubenspeck <ma...@oddprocess.org>.
On Sun, Sep 01, 2002 at 01:31:50PM -0600, Grant Cooper wrote:
> This is new to me. I currently am using apache 1.3, mod_php, mod_perl. I
> just installed phpMyAdmin for mysql and trying to secure it. I was told to
> password protect the directory. Where should I start?

Look up .htpasswd

---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
   "   from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org


RE: [users@httpd] password protect a directory

Posted by Koen Vingerhoets <ko...@ubench.com>.
Hi,

if you want to protect it in MySQL:

log in, go to your domain, you'll see a tab directories.


Met vriendelijke groet,

Koen Vingerhoets

***** UBench nv *****
http://www.ubench.com
____________________________________________
The information contained in this electronic mail message is privileged and
confidential,
and is intended only for use of the addressee. If you are not the intended
recipient, you
are hereby notified that any disclosure,reproduction, distribution or other
use of this
communication is strictly prohibited.

If you have received this communication in error, please notify the sender
by reply
transmission and delete the message without copying or disclosing it.


-----Original Message-----
From: Grant Cooper [mailto:grant.cooper@nucleus.com]
Sent: 01 September 2002 21:32
To: users@httpd.apache.org
Subject: [users@httpd] password protect a directory


This is new to me. I currently am using apache 1.3, mod_php, mod_perl. I
just installed phpMyAdmin for mysql and trying to secure it. I was told to
password protect the directory. Where should I start?


---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
   "   from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org





---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
   "   from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org