lundi 8 avril 2019

Is it possible to have .htpasswd authentication and masked URL redirect (to hide full URL) in same .htaccess file?

I need to setup .htpasswd to authenticate users based on either their username and password and IP address, but once authenticated need to redirect them while retaining the URL.

I can setup the .htpasswd and the redirect, but not in the same .htaccess file, as it just bypasses the authentication.

Here's what I've got, how do I make the result but in the same .htaccess file?

.htpasswd Authentication:

AuthType Basic AuthName "Authentication Required" AuthUserFile /var/www/xxxx/.htpasswd Require valid-user Order Deny,Allow Deny from all Allow from xxx.xxx.xxx.xxx Satisfy any

.htaccess Reverse Proxy / Masked Redirect:

RewriteEngine On Options +FollowSymLinks -MultiViews RewriteBase /

RewriteCond %{HTTPS} !on RewriteRule (.*) https://home.example.come%{REQUEST_URI} [L,R=301]

RewriteCond %{HTTP_HOST} ^(www.)?books.obrien.in$ [NC] RewriteRule ^ https://server.example.come:26657%{REQUEST_URI} [L,NE,P]




Aucun commentaire:

Enregistrer un commentaire