简体   繁体   中英

Symfony2 protect admin panel with .htaccess

i have a web project developed with Symfony2 and i would like to protect my admin panel by BOT's continuos scan. Now there is just a simple authentication with username and password but i would like set also a .htaccess and .htpasswd authentication.

Usually we have to put the .htaccess file inside the folder to protect but with Symfony2 i don't have a folder where is located the admin panel to protect.

I didn't found any other posts with the same issue. Someone known some way to do what i wrote above?

Thanks

If you're using RESTful URLs, you're probably out of luck.

Apache still parses the .htaccess if you create a folder path with the same names, but these will only be valid for the files actually in there and not for the REST-'fallback'. You'll have to find an symfony2-solution, eg implementing a login system and edit the corresponding files.

Not sure about this, but if you have a login system and think it's not secure enough, you probably should think about your security at first. However, if you still want http auth, you can do it via php also.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM