Welcome to the LimeSurvey Community Forum

Ask the community, share ideas, and connect with other LimeSurvey users!

Where to put the .htaccess file?

  • ymca
  • ymca's Avatar Topic Author
  • Offline
  • Elite Member
  • Elite Member
More
3 years 11 months ago #198038 by ymca
Where to put the .htaccess file? was created by ymca
Hi,

I have an .htaccess file that I made so users will not be able to get to the site.
Now I want to enable them to go in the site but not to the admin page.
Where do I need to move the file so it will ask for a password just for admin login but not for regular users in the front end?
The file looks like this:
Code:
AuthType Basic
AuthName "Access to /xxxx/"
AuthUserFile /xxxx/htpasswd
Require user xxxx

LS Version 4.2+
The topic has been locked.
  • ymca
  • ymca's Avatar Topic Author
  • Offline
  • Elite Member
  • Elite Member
More
3 years 11 months ago #198146 by ymca
Replied by ymca on topic Where to put the .htaccess file?
Have been able to do it by "Password protect a specific URL"
Code:
RewriteEngine On 
RewriteCond %{SERVER_PORT} 80 
RewriteRule ^(.*)$ https://mysite.com/$1 [R,L]
 
AuthType Basic
AuthName "Access to /mysite/"
AuthUserFile /directory of htpasswd
Require user xxxx
 
AuthGroupFile /dev/null
 
SetEnvIf Request_URI .* noauth
SetEnvIf Request_URI index.php/admin/authentication/sa/login !noauth
 
<RequireAny>
  Require env noauth
  Require valid-user
</RequireAny>

LS Version 4.2+
The topic has been locked.

Lime-years ahead

Online-surveys for every purse and purpose