Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

brentxscholl's avatar

Password protect a deployed site that uses Authentication so a client can see, but no one else.

Say I have a Laravel project completed and I want to deploy the site online to my client's server. However for the first 2 weeks my client will want to go over the site and confirm it's functionality.

During this time we would not want anyone else to visit the domain and see the site. The site should only be viewable to my client and who ever else they approve. I would achieve this by giving my client some kind of password to view the site.

The Laravel project already contains a user login system to show pages that are already protected by Authentication. ie. account pages. However the site has pages that are not protected by Authentication such as the home page, login page, registrations page, etc.

So, how would I create a temporary default landing page that is simply just a password input, that my client can use to enter a password and proceed to the site?

Note: This should not "Authenticate" my client to see the account pages that were already protected. They should be able to now see the home page, register page, login page etc. but will still have to register and login to see the account pages.

0 likes
4 replies
Cronix's avatar

The simplest solution is to use HTTP Basic Auth, which would put the whole site behind a username/password. This won't interfere with laravel at all, and is completely outside of laravels auth. In other words, you browse to the domain and immediately see a username/password prompt before you can see any content. Once it's entered, you'd then be allowed to browse the site and use it normally.

It's pretty easy to set up, but it differs depending on the web server (nginx/apache/etc). You can even set up multiple users/passwords and see which ones are accessing the site in the server logs.

I'd do that, and then just remove it after it no longer needs to be private.

For Apache: https://www.digitalocean.com/community/tutorials/how-to-set-up-password-authentication-with-apache-on-ubuntu-14-04

For Nginx: https://docs.nginx.com/nginx/admin-guide/security-controls/configuring-http-basic-authentication/

Another possibility is to allow access to the server by specific ips, and deny everything else. That's more problematic, though.

1 like
Tray2's avatar

I would not play around with that kind of authentication but rather host the site somewhere secure (not on the public web).

Either on a server on the clients intranet which is only accessible from their network or put it behind a VPN on a machine you host. Or even take it as far as to put it on a virtual host running lamp/lemp that they can have on their local machines.

1 like
brentxscholl's avatar

Thanks for the info guys! Looks like there are a few options.

My client is remote. So it has to be put online. They will need changes once they see the project, so having it in an "Under Construction" mode would work the best.

Please or to participate in this conversation.