I had a lot of projects under my development server. I used a subdomain (folder) to store all the projects. the url is : demo.MYDOMAIN.com
So, When someone types this url on his browser, he’s able to see all of my folders there but I don’t want everyone to be able to see full list. But at the same time, I want some authorized people to be able to see the list but without using any password. They’ll just have an url and be able to see the folders list with that url.
So, I won’t be using password protection.
However, I need a solution. So, I continued and finally figured out a solution.
I created a file named index.php and put the following code in that file.
And thats it!!
This code does everything I need.
Now when someone goes to demo.MYDOMAIN.com, he gets the following error
Sorry! Authorised people Only
But when the put the url like: demo.MYDOMAIN.com?access=admin
They’ll see the list of folders.