跳至内容
菜单
此问题已终结
1 回复
8562 查看

Hello,

I want to configure the htaccess for my server, so when any one clic on the my_domaine:8069/web 

he give me popup asking for

htaccess (login, password)

i work with vps server with ubuntu as OS

形象
丢弃
最佳答案

Hello

If you have set the .htaccess file for apache2  you need to set .htaccess password file. below is the sample code to use in .htaccess.


#set an environtment variable "auth" if the request starts with "/web" 
SetEnvIf Request_URI ^/web auth=1
AuthName "Please login to access backend!"
AuthType Basic AuthUserFile "/pathtoyour.htpasswd"
 
Order Allow,Deny
Satisfy any
Allow from all
Require valid-user
# then, deny only if required
Deny from env=auth
形象
丢弃
编写者

Thank youk kazim , can you explain more i have a vps server on it i install only the odoo !! how i should process ?

编写者

OS is ubuntu

You just need to add one file in /var/www/html folder Go to that folder and run command sudo nano .htaccess and then you need to place basic htaccess contains there you can use this http://www.htaccessredirect.net/ to generate it easily .

编写者

I make my files under /var/www/html with this structure: FOR HTACCESS FILE #set an environtment variable "auth" if the request starts with "/web" SetEnvIf Request_URI ^/web auth=1 AuthName "Please login to access !" AuthType Basic AuthUserFile "/var/www/html/.htpasswd" Order Allow,Deny Satisfy any Allow from all Require valid-user # then, deny only if required Deny from env=auth FOR HTPASSWD aymen:kPMZE4nuXggHA But nothing is changed !! i don't know the pb excatly can you correct me Sir !

编写者

i should activate the apache server or no ?