damonky.co.uk - Web development | Illustration | Flex | Papervision | Actionscript | Devon

Conditional Authentication using .htaccess

Working on sites very close to live is always tricky. Clients want to use the site unhindered, you want to check it through before it goes live. The one thing you don’t want happen is for the public to discover and access the site before it goes live.

The code below allows only grant access without authentication to a set of IP’s / domains. Any request from a  domain not in this list will be asked to authenticate. Satisfy any allows the .htaccess to grant permission to anyone who meets the two key criteria. In the example you will note that google’s domains have been allowed through so as not to affect SEO too much. Replace 123.123.123.123 with your IP, or that of whoever you wish to access the site. I am yet however to find one that works for dynamic IP’s – wouldn’t that be neat :D

You will of course need to create a .htpasswd file. a good generator can be found at http://www.htaccesstools.com/htpasswd-generator/ along with a load of other goodies.


 Bash | 
 copy code |
?
01
#require authentication of requests
02
AuthName "Restricted Area"
03
AuthUserFile /var/www/.htpasswd
04
AuthType basic
05
Require valid-user
06
#deny access to all, allow for selected ip's / domains
07
Order Deny,Allow
08
Deny from all
09
Allow from 123.123.123.123 googlebot.com google.com google-analytics.com
10
#if any of these rules are satisfied they may proceed
11
Satisfy Any
12
Share and Enjoy:
  • Digg
  • TwitThis
  • del.icio.us
  • TailRank
  • Facebook
  • Technorati
  • LinkedIn
  • Google

A quick re-design preview.

sneak peak header

I’ve been rattling away on  paper and in photo shop for a few weeks now trying to come up with a new blog design. My aim was to create a site rather than a blog, and as such I’ve decided to create a homepage and move the blog to a subsection. Below are a few snaps of my progress so far. There’s still a few more pages to think about. I’m strongly considering some form of papervision for the gallery, but that may be a phase 2 project.

I hope this is close to the final mocks and so I would welcome any feedback, constructive criticism too. Anyway please take a look.

The Homepage to date

The Homepage



Homepage banner rotation linking to gallery items

Homepage banner rotation linking to gallery items



A Sample Internal / Blog Page

A Sample Internal / Blog Page

Share and Enjoy:
  • Digg
  • TwitThis
  • del.icio.us
  • TailRank
  • Facebook
  • Technorati
  • LinkedIn
  • Google

one week ago i was in the alps :)

At about 2000 feet overlooking bourg de ousin, this is one of my favourite moments of the holiday.

Posted via email from damonky’s posterous

Share and Enjoy:
  • Digg
  • TwitThis
  • del.icio.us
  • TailRank
  • Facebook
  • Technorati
  • LinkedIn
  • Google