JavaScript
  Home arrow JavaScript arrow Page 3 - Server-side redirects: .htaccess versus Me...
Dev Articles Forums 
ADO.NET  
Apache  
ASP  
ASP.NET  
C#  
C++  
ColdFusion  
COM/COM+  
Delphi-Kylix  
Design Usability  
Development Cycles  
DHTML  
Embedded Tools  
Flash  
Graphic Design  
HTML  
IIS  
Interviews  
Java  
JavaScript  
MySQL  
Oracle  
Photoshop  
PHP  
Reviews  
Ruby-on-Rails  
SQL  
SQL Server  
Style Sheets  
VB.Net  
Visual Basic  
Web Authoring  
Web Services  
Web Standards  
XML  
Mobile Linux 
App Generation ROI 
IBM® developerWorks 
Sun Developer Network 
Weekly Newsletter
 
Developer Updates  
Free Website Content 
 RSS  Articles
 RSS  Forums
 RSS  All Feeds
Write For Us Get Paid 
Request Media Kit
Contact Us 
Site Map 
Privacy Policy 
Support 
 USERNAME
 
 PASSWORD
 
 
  >>> SIGN UP!  
  Lost Password? 
JAVASCRIPT

Server-side redirects: .htaccess versus Meta Redirects
By: Stephen Davies
  • Search For More Articles!
  • Disclaimer
  • Author Terms
  • Rating: 5 stars5 stars5 stars5 stars5 stars / 6
    2007-11-28

    Table of Contents:
  • Server-side redirects: .htaccess versus Meta Redirects
  • How .htaccess can help you: Custom Error Pages
  • Password Protection / Authentication
  • Enabling SSI (Server-Side Includes)
  • Redirects
  • Pros and Cons

  • Rate this Article: Poor Best 
      ADD THIS ARTICLE TO:
      Del.ici.ous Digg
      Blink Simpy
      Google Spurl
      Y! MyWeb Furl
    Email Me Similar Content When Posted
    Add Developer Shed Article Feed To Your Site
    Email Article To Friend
    Print Version Of Article
    PDF Version Of Article
     
     
    ADVERTISEMENT


    Server-side redirects: .htaccess versus Meta Redirects - Password Protection / Authentication


    (Page 3 of 6 )

    Have you ever wanted a specific directory in your site to be available only to certain people? Have you ever found yourself frustrated with the holes in client-side options for this that allowed virtually anyone with enough skill to mess around in your source to get in? Then htaccess is the answer! There are numerous methods that let you password protect areas of your website, some server language bases (such as Java, PHP or ASP) and client-side-based, such as JavaScript. Htaccess is about as secure as you can or need to get in everyday life, though there are ways above and beyond even those of htaccess.

    For example if you had uploaded some photos to your web site under the path - /album/ and want to share the photos ONLY with your girlfriend named Jessica, that name would need to be specified. The first thing you will need to do is create a file called .htpasswd or something else you like. You can use the httpd build-in program with the Apache Server called htpasswd.

    >htpasswd –c /local/usr/.htpasswd Jessica

    The program will prompt you to enter the password for the user Jessica, and then a file .htpasswd is created and stored in the path /local/usr/.htpasswd.

    Secondly, you need to create the .htaccess file and place it under the /album/ directory with the following content:


    AuthType Basic

    AuthName EnterPassword

    AuthUserFile /local/usr/.htpasswd

    Require user Jessica

    The above code fragment indicates that it will use Basic Authentication to authenticate the user, and only the user Jessica is allowed access to the /album/ directory.

    More JavaScript Articles
    More By Stephen Davies


       · .htaccess redirects seem to cause a huge problem in FF2.0 as the browser downloads...
     

    JAVASCRIPT ARTICLES

    - Using Click Interceptions with a Database-Dr...
    - Using JavaScript Click Interceptions in an I...
    - Using Click Interceptions with JavaScript
    - QuickSort in Action
    - Quicksort
    - Using Mod_Security to Protect Your Server
    - Detecting and Countering Server Intrusions
    - Securing Your Web Server
    - Building a Secure Web Server
    - Protecting the Server
    - Book Review: Learning the Yahoo! User Interf...
    - Dynamically Generate a Selection List in a R...
    - Intergrate DWR into Your Java Web Application
    - Detect Browser Compatibility with the Reques...
    - Using the EXT JS Date Picker Widget






    © 2003-2008 by Developer Shed. All rights reserved. DS Cluster 4 hosted by Hostway
    Stay green...Green IT