Php 使用异常条件重写某些查询字符串

Php 使用异常条件重写某些查询字符串,php,.htaccess,Php,.htaccess,我不熟悉htaccess的用法 需要以下方面的帮助吗 Form http://mysite.com/index.php?page=login to http://mysite.com/login 我在htaccess中使用了以下规则 RewriteEngine On RewriteRule ^([a-zA-Z0-9_-]+)/$ index.php?page=$1 同样,我必须限制对mysite.com/admin文件夹的访问 如果我进去的话 `http://mysite.com/adm

我不熟悉htaccess的用法

需要以下方面的帮助吗

Form http://mysite.com/index.php?page=login to http://mysite.com/login
我在htaccess中使用了以下规则

RewriteEngine On

RewriteRule ^([a-zA-Z0-9_-]+)/$ index.php?page=$1
同样,我必须限制对
mysite.com/admin
文件夹的访问

如果我进去的话

 `http://mysite.com/admin` then it goes to `http://mysite.com/admin?page=admin`
我认为这是上述规则的一部分


我需要的是,如果我输入
mysite.com/admin
,那么应该在
mysite.com/admin/index.php
中添加重写规则的条件:

RewriteEngine on
RewriteCond $1 !^admin
RewriteRule ^(.*)$ index.php?page=$1 [L,NC]