想要在cakephp中的特定页面上启用htaccess密码功能吗

想要在cakephp中的特定页面上启用htaccess密码功能吗,php,.htaccess,cakephp,Php,.htaccess,Cakephp,这是我的密码 <IfModule mod_rewrite.c> RewriteEngine on RewriteRule ^$ app/webroot/ [L] RewriteRule (.*) app/webroot/$1 [L] </IfModule> <LocationMatch "http://<server name>/bikes/brand/index/*"> AuthType Basic

这是我的密码

<IfModule mod_rewrite.c>
   RewriteEngine on
   RewriteRule    ^$ app/webroot/    [L]
   RewriteRule    (.*) app/webroot/$1 [L]
</IfModule>
<LocationMatch "http://<server name>/bikes/brand/index/*">
    AuthType Basic
    AuthName "restricted area"
    AuthUserFile "/home/public_html/sites/labs/bikes/.htpasswds"
    require valid-user
</LocationMatch>

重新启动发动机
重写规则^$app/webroot/[L]
重写规则(*)app/webroot/$1[L]
AuthType Basic
AuthName“限制区”
AuthUserFile“/home/public\u html/sites/labs/bikes/.htpasswds”
需要有效用户
实际上,我只想为一个页面启用htaccess密码,页面链接如下http:///bikes/homes/index/


但是我不想在任何其他页面上使用htaccess密码。谢谢使用此代码尝试将其添加到您的.htaccess并参考以下内容:


需要有效用户

谢谢Ashish,但我实际上使用的是cakephp,所以我不能像您那样给出文件名。
<Files "index.php">
  Require valid-user
</Files>