website hosting htaccess popup

I have a website with pictures hosted on it.
I want to protect it using htaccess, so that means a box should pop if my site is accessed prompting a username and password.

The key thing is that NOBODY from anywhere, i.e  google should not be able to access the site OR the pictures.

In any case the user must be prompted to provide a username and password
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Add to the htaccess

AuthType Basic
AuthName "Some title for the authorisation box"
AuthUserFile /path_to_file/.htpasswd
Require valid-user

Open in new window

Create the .htpasswd file in the location you set above. and in this file add your users in the format

Open in new window


Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
hulseboschSystem administratorCommented:
To block Google from indexing, create a .htaccess file in your root dir.
# block google

RewriteEngine On

RewriteCond %{HTTP_USER_AGENT}   ^googlebot
RewriteRule ^/go/ - [F,L]

Open in new window

The word GO will be replaced with the folder you dont want indexed.
You don't need to block Google et al as it will never get past the Authorisation.
And that is not how you block search bots anyway - thats what the robots.txt file was created for.
Big Business Goals? Which KPIs Will Help You

The most successful MSPs rely on metrics – known as key performance indicators (KPIs) – for making informed decisions that help their businesses thrive, rather than just survive. This eBook provides an overview of the most important KPIs used by top MSPs.

hulseboschSystem administratorCommented:

robots.txt are not being obeid by all search bots (to bad). Thats why I gave this script.
It gives an option to secure from searchbots without having to login.
Still, you are very correct where it comes to autorisation blokking search engines.
(which was the actual question in the first place. My mistake)
robots.txt are not being obeid by all search bots
And having 1000's of lines of blocking code for all the bad ones will do you no good either ;o)
hulseboschSystem administratorCommented:
Youve just got yourself a very good point ;-)
Ikky786Author Commented:
im bit confused, are we saying its not possible?
I gave you the answer in the very first comment
hulseboschSystem administratorCommented:
When considering your question and remark
The key thing is that NOBODY from anywhere...
Indeed, the first comment from Gary is the way to establish this.
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Microsoft Legacy OS

From novice to tech pro — start learning today.