Forum Moderators: phranque
the problem is I also have phpmyadmin installed and the .htaccess file is causing problems.
is there a way to tell the .htaccess file to protect all but certain areas? I don't want to type all the directories to protect because there are hundreds, i just want to list a few that don't need protection.
what is the best way to do this?
For instance in my .htaccess file
AuthUserFile "C:/Program Files/Apache Software Foundation/Apache2.2/htdocs/.htpasswd"
AuthName "Password Protected"
AuthType Basic
require valid-user
- omit directory /phpmyadmin/
Basically, you tell the server that if the Request_URI is NOT the root directory or a small number of protected directories, then allow access even without 'valid-user'.
I believe there's an example in one of the Apache.org tutorials cited in our Forum Charter.
Jim
home server
php
mysql
phpmyadmin
im using htaccess to force password when entering site
i want to remove that password over the folder for my phpmyadmin
phpmyadmin has its own password and the two seem to be conflicting
so id like to do something like this
password protect all directories with the same login, pass omit folder /phpmyadmin/ and use its own login, pass
ive got this in there but dont quite understand it
SetEnvIf Request_URI "/phpMyAdmin/$" allow_all
Order allow,deny
Allow from env=allow_all
Satisfy any
AuthUserFile "C:/Program Files/Apache Software Foundation/Apache2.2/htdocs/.htpasswd"
AuthName "Password Protected"
AuthType Basic
require valid-user
This stuff never seems to work the way one thinks it should...
Here is my best guess, and because I always seem to struggle with it just like everyone else, it is only a guess:
# Define Auth file, realm, and type
AuthUserFile "C:/Program Files/Apache Software Foundation/Apache2.2/htdocs/.htpasswd"
AuthName "Password Protected"
AuthType Basic
#
# Set access control evaluation priority -- Allows override Denys
Order Deny,Allow
#
# Treat "Require" and "Allow" directives as equivalent
Satisfy any
#
# Detect always-allowed URL-path(s)
SetEnvIf Request_URI [b]"^/p[/b]hpMyAdmi[b]n/"[/b] allow_all
#
# Default access state if not authorized or not requesting an always-allowed URL-path is "Deny"
Deny from all
#
# Allow authorized users
Require valid-user
#
# Allow everybody to access always-allowed URL-path(s)
Allow from env=allow_all
This is the basic problem you are fighting. It is more usual to have the top-level directories open, and to place restricted content in subdirectories below that open level.
Jim
Let me explain my current set up.
Home test server where I build websites etc
everything is in the root directory including phpmyadmin
should i have a directory named websites and put all websites in that directory and pass protect that? and leave the rest open? and then have separate login for the phpmyadmin directory? also im using vhosts to instruct the exact location of each website directory, so in essence in would not be too hard to put them all in a websites directory?