0
我用Sinatra編寫了一個小應用程序,並且有一些管理路線(/ admin/new,admin/edit/2,...),並希望通過.htaccess提示來保護它們。有人可以告訴我我是怎麼做到的?我可以用.htaccess文件保護與sinatra的一些路線嗎?
我用Sinatra編寫了一個小應用程序,並且有一些管理路線(/ admin/new,admin/edit/2,...),並希望通過.htaccess提示來保護它們。有人可以告訴我我是怎麼做到的?我可以用.htaccess文件保護與sinatra的一些路線嗎?
AuthName "Restricted Area"
AuthType Basic
AuthUserFile /path/to/file/.htpasswd
<Files "protected.html">
Require valid-user
</Files>
如果您想使用Sinatra進行身份驗證,請查看this faq。