Bỏ qua để đến Nội dung
Menu
Câu hỏi này đã bị gắn cờ
1 Trả lời
8573 Lượt xem

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

Ảnh đại diện
Huỷ bỏ
Câu trả lời hay nhất

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
Ảnh đại diện
Huỷ bỏ
Tác giả

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

Tác giả

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 .

Tác giả

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 !

Tác giả

i should activate the apache server or no ?