的.htaccess code,以保护单一的网址是什么? [英] .htaccess code to protect a single URL?
本文介绍了的.htaccess code,以保护单一的网址是什么?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
是否有可能来保护通过的.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>
这篇关于的.htaccess code,以保护单一的网址是什么?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文