Quantcast
Channel: Password protect a specific URL - Stack Overflow
Browsing latest articles
Browse All 11 View Live
↧

Answer by Thomas Leu for Password protect a specific URL

In Apache2.4 you can do:<If "%{REQUEST_URI} =~ m#/pretty/url/?#i"> AuthUserFile /var/www/htpasswd AuthName "Password protected" AuthType Basic Require valid-user</If>

View Article


Answer by Mohammad for Password protect a specific URL

First of all, you need to create a new user/password:This command:htpasswd -c /etc/apache2/.htpasswd myuser1If you are using Bitnami Apps (Open edx, for example), you need follow this...

View Article


Answer by Pierre Priot for Password protect a specific URL

I updated Jon Lin's code for the purpose of protecting all URLs except for one - for instance robots.txt at the vhost's root. These are Apache 2.2 compliant directives.<ifmodule...

View Article

Answer by Imanuel for Password protect a specific URL

Since Rick stated in a comment that no answer in this question works, here is the snippet I use:AuthName "Protected Area"AuthType BasicAuthUserFile /path/to/your/.htpasswdAuthGroupFile...

View Article

Answer by mgutt for Password protect a specific URL

What about redirecting the user to a password protected subfolder? .htaccessRewriteCond %{HTTP_COOKIE} !BadHorsie=secret_cookie_keyRewriteRule ^(pretty/url)$ /protected/login.php?url=$1...

View Article


Answer by Stefan for Password protect a specific URL

All the provided solutions didn't work for me. I figured following directives do the trick:SetEnvIf Request_URI ^/page-url auth=1AuthName "Please login"AuthType BasicAuthUserFile...

View Article

Answer by simne7 for Password protect a specific URL

Unfortunately I can't comment on @jon-lin answer. So, I create a new answer. My adapted solution in an apache 2.4 environment is:## password protect /pretty/url URIs#AuthType BasicAuthName...

View Article

Answer by Coder for Password protect a specific URL

You can use <LocationMatch> or simply <Location> inside your <VirtualHost> directive to do this (assuming you have access to your httpd.conf / vhost.conf - alternatively you could put...

View Article


Answer by Dennis for Password protect a specific URL

the solution above is too busy and messed up a bit.. I go for simplicity and clarity like this<Files "protected.html"> AuthName "Username and password required" AuthUserFile...

View Article


Answer by Jon Lin for Password protect a specific URL

You should be able to do this using the combination of mod_env and the Satisfy any directive. You can use SetEnvIf to check against the Request_URI, even if it's not a physical path. You can then check...

View Article

Password protect a specific URL

The site is on shared hosting. I need to password protect a single URL.http://www.example.com/pretty/urlObviously that's not a physical file path I'm trying to protect, it's just that particular...

View Article
Browsing latest articles
Browse All 11 View Live


<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>