Solved

website hosting htaccess popup

Posted on 2014-12-23
9
95 Views
Last Modified: 2015-02-06
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
0
Comment
Question by:Ikky786
  • 4
  • 4
9 Comments
 
LVL 58

Accepted Solution

by:
Gary earned 500 total points
ID: 40515570
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
User1:Password1
User2:Password2
etc

Open in new window

0
 
LVL 4

Expert Comment

by:hulsebosch
ID: 40515650
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.
0
 
LVL 58

Expert Comment

by:Gary
ID: 40515676
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.
0
Space-Age Communications Transitions to DevOps

ViaSat, a global provider of satellite and wireless communications, securely connects businesses, governments, and organizations to the Internet. Learn how ViaSat’s Network Solutions Engineer, drove the transition from a traditional network support to a DevOps-centric model.

 
LVL 4

Expert Comment

by:hulsebosch
ID: 40515690
Gary,

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)
0
 
LVL 58

Expert Comment

by:Gary
ID: 40515696
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)
0
 
LVL 4

Expert Comment

by:hulsebosch
ID: 40515715
Youve just got yourself a very good point ;-)
0
 

Author Comment

by:Ikky786
ID: 40565582
im bit confused, are we saying its not possible?
0
 
LVL 58

Expert Comment

by:Gary
ID: 40565612
I gave you the answer in the very first comment
0
 
LVL 4

Expert Comment

by:hulsebosch
ID: 40566288
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.
0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
dynamic created check uncheck boxes 6 42
CSS Style 8 43
HTML question 2 26
office 2010 not starting even in safe mode 9 169
The article shows the basic steps of integrating an HTML theme template into an ASP.NET MVC project
Originally, this post was published on Monitis Blog, you can check it here . Websites are getting bigger and more complicated by the day. Video, images and custom fonts are all great for showcasing your product or service. But the price to pay in…
The viewer will learn how to dynamically set the form action using jQuery.
The viewer will learn how to create and use a small PHP class to apply a watermark to an image. This video shows the viewer the setup for the PHP watermark as well as important coding language. Continue to Part 2 to learn the core code used in creat…

726 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question