0

I have a server where I have a few tester sites in a folder. Hence all of those tester sites are in mysites folder.

What I am hoping is that no one accessing my site is able to go to

  • www.example.com/mysite/
  • or www.example.com/mysite/site1
  • or www.example.com/mysite/site2

I want everything under www.example.com/mysite/ to be password protected. Is it possible?

Maybe through .htaccess?

MrWhite
  • 11,643
  • 4
  • 25
  • 40
user219492
  • 99
  • 4

2 Answers2

1

Yes, you can use .htaccess to do that.

There is an answer on how to use it here :https://stackoverflow.com/questions/5229656/password-protecting-a-directory-and-all-of-its-subfolders-using-htaccess

Dazounet
  • 45
  • 1
  • 8
0

A .htaccess is recursive by default:

.htaccess files (or "distributed configuration files") provide a way to make configuration changes on a per-directory basis. A file, containing one or more configuration directives, is placed in a particular document directory, and the directives apply to that directory, and all subdirectories thereof.

Just place your .htaccess to mysite directory and use the authentication example.

Esa Jokinen
  • 43,252
  • 2
  • 75
  • 122