Password Protected A Subdomain In Parallels Plesk 11.5

Password Protected A Subdomain In Parallels Plesk 11.5

I have just recently had to password protect a subdomain on a server running Plesk and let me tell you it's not a simple as it should be. My story and how I managed it in the end...

An Optimistic Start

So there I was happily in my Plesk panel I hit the add subdomain button, gave it a name and pressed OK ... Hey Presto! My new subdomain created. I see it in my browser too.

So now I went to the 'Password Protect Folders' option, entered the folder to protect and thought that was it... I should of know that nothing can be that simple, it should be but with Plesk it is not.

As it turns out (after spending some hours googling the problem and reading the docs) you cannot password protect a subdomain in Plesk this way, only the main domain in http docs folder, a bit silly if you ask me but there you go that's the way it is. You can do it but it's a little bit of a hack.

So what you do is: make the subdomain, let's call if 'mysubdomain.com', as normal then go to the password protect folders option and add a new folder, can be called anything but make sure it's not a folder that's going to be used in your main site, let's call it '_myprivatesite'.

Now in the subdomain root folder add a .htaccess file and add:

AuthType Basic
AuthName "Private Site"
AuthUserFile "/var/www/vhosts/system/mysubdomain.com/pd/[email protected]_myprivatesite"
require  valid-user
Options +FollowSymLinks

Don't forget to substitute 'mysubdomain.com' with what you called your subdomain and '_myprivatesite" with what you called your protected folder and that it you should a password protected subdomain now.

Hope this helps


14/04/2014 10:42:00 Shaun Freeman Filed Under: Linux Linux, Plesk, Server

Twitter Feed
Shaun Freeman @Zendmaster

Shaun Freeman @Zendmaster

I liked a @YouTube video https://t.co/lSFWmpHTX1 Patrick Stewart talks about meeting Sting on the set of DUNE (Funny to the EXTREME)

Shaun Freeman @Zendmaster

I added a video to a @YouTube playlist https://t.co/pmXSmod4ti Anonymous - This will Change Everything You Know... (2018-2019)

Shaun Freeman @Zendmaster

I added a video to a @YouTube playlist https://t.co/GkwTCvBfes Will Artificial Intelligence Take Over The World?

Shaun Freeman @Zendmaster

I liked a @YouTube video https://t.co/Y1ulafmsC6 Frank Abagnale: "Catch Me If You Can" | Talks at Google

Shaun Freeman @Zendmaster

I liked a @YouTube video https://t.co/NBdW2xFnqD ETS2: Special Transport DLC Trailer