我的根文件夹确实有以下 .htaccess:
Options -Indexes
Options +FollowSymLinks
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteCond %{HTTP_HOST} ^yourdomain.com [NC]
RewriteRule ^(.*)$ http://www.yourdomain.com/$1 [L,R=301]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule .* loader.php [L,QSA]
</IfModule>
我想从 RewriteRule 的规则中排除 siteadmin 的文件夹。* loader.php [L,QSA] 在根文件夹
在子文件夹内:“siteadmin”我确实有另一个 .htaccess 文件,如下所示:
AuthType Basic
AuthName "siteadmin"
AuthUserFile "/home/user1/.htpasswds/public_html/siteadmin/passwd"
require valid-user
loader.php(在根目录上):
<?php
//die('Only enable this script if you dont have support for MultiViews');
$relative = '';
$loaders = array(
'ajax' => 1,
'album' => 1,
'albums' => 1,
'blog' => 1,
'blogs' => 1,
'captcha' => 1,
'categories' => 1,
'community' => 1,
'confirm' => 1,
'error' => 1,
'feedback' => 1,
'feeds' => 1,
'game' => 1,
'games' => 1,
'index' => 1,
'invite' => 1,
'loader' => 1,
'login' => 1,
'logout' => 1,
'lost' => 1,
'mail' => 1,
'notice' => 1,
'notices' => 1,
'photo' => 1,
'requests' => 1,
'search' => 1,
'signup' => 1,
'static' => 1,
'stream' => 1,
'upload' => 1,
'user' => 1,
'users' => 1,
'video' => 1,
'videos' => 1,
'edit' => 1
);
$query = ( isset($_SERVER['QUERY_STRING']) ) ? $_SERVER['QUERY_STRING'] : NULL;
$request = str_replace($relative, '', $_SERVER['REQUEST_URI']);
$request = str_replace('?' .$query, '', $request);
$request = explode('/', trim($request, '/'));
if (isset($request['0'])) {
$page = $request['0'];
if (isset($loaders[$page])) {
require $page. '.php';
} else {
header('HTTP/1.0 404 Not Found');
die();
}
} else {
header('HTTP/1.0 404 Not Found');
die();
}
?>
当我访问http://www.domain.com/signup之类的网站时,loader.php 会执行此操作 ,它将加载 signup.php
站点管理员仍然无法使用密码保护。无论如何我可以从 loader.php 规则中排除文件夹 siteadmin 吗?