Solved

website hosting htaccess popup

Posted on 2014-12-23
9
92 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
 
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
How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

 
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

IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

Ever notice how you can't use a new drive in Windows without having Windows assigning a Disk Signature?  Ever have a signature collision problem (especially with Virtual Machines?)  This article is intended to help you understand what's going on and…
Citrix XenApp, Internet Explorer 11 set to Enterprise Mode and using central hosted sites.xml file.
In this tutorial viewers will learn how to embed videos in a webpage using HTML5. Ensure your DOCTYPE declaration is set to HTML5: "<!DOCTYPE html>": Use the <video> tag to insert a video. Define the src as the URL of your video; this is similar to …
The viewer will learn the basics of jQuery, including how to invoke it on a web page. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery.: (CODE)

743 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

Need Help in Real-Time?

Connect with top rated Experts

15 Experts available now in Live!

Get 1:1 Help Now