是否有可能来保护通过的.htaccess
一个URL?例如,我将有 website.com/index.php?skin=name
。我可以使用密码保护仅此网址是什么? (没有PHP的变化,只有的.htaccess
)
Is it possible to protect a single URL through .htaccess
? For example I will have website.com/index.php?skin=name
. Can I password protect only this url? (with no PHP changes, only .htaccess
)
website.com/index.php
或 website.com/index.php?skin=other_name
不应该受到限制。
您可以重写的地址,以保护它是这样的:
You can rewrite the address to protect it like this:
RewriteEngine On
RewriteCond %{REQUEST_URI} ^/index.php$
RewriteCond %{QUERY_STRING} ^skin=(name)$
RewriteRule ^(.*)$ /skin/%1 [PT]
<LocationMatch "/skin/name">
AuthType Basic
AuthName "By Invitation Only"
AuthUserFile /path/to/passwords
Require valid-user
</LocationMatch>