Solved

website hosting htaccess popup

Posted on 2014-12-23
9
94 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
ScreenConnect 6.0 Free Trial

At ScreenConnect, partner feedback doesn't fall on deaf ears. We collected partner suggestions off of their virtual wish list and transformed them into one game-changing release: ScreenConnect 6.0. Explore all of the extras and enhancements for yourself!

 
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

DevOps Toolchain Recommendations

Read this Gartner Research Note and discover how your IT organization can automate and optimize DevOps processes using a toolchain architecture.

Question has a verified solution.

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

Building a website can seem like a daunting task to the uninitiated but it really only requires knowledge of two basic languages: HTML and CSS.
This article discusses how to create an extensible mechanism for linked drop downs.
The viewer will learn how to look for a specific file type in a local or remote server directory using PHP.
The viewer will receive an overview of the basics of CSS showing inline styles. In the head tags set up your style tags: (CODE) Reference the nav tag and set your properties.: (CODE) Set the reference for the UL element and styles for it to ensu…

770 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