Home arrow JavaScript arrow Page 3 - Server-side redirects: .htaccess versus Meta Redirects
JAVASCRIPT

Server-side redirects: .htaccess versus Meta Redirects


URL redirects are needed for a number of reasons. One example is when you have changed significant portions of your website, and then have to deal with the problem of people finding their way from the old pages to the new pages. There are different ways of redirecting pages, through Meta tag http-equiv, JavaScript or any of the server-side languages. And what’s more, you can do it through .htaccess, which is probably the most effective, considering the minimal amount of work required to do it.

Author Info:
By: Stephen Davies
Rating: 5 stars5 stars5 stars5 stars5 stars / 7
November 28, 2007
TABLE OF CONTENTS:
  1. · Server-side redirects: .htaccess versus Meta Redirects
  2. · How .htaccess can help you: Custom Error Pages
  3. · Password Protection / Authentication
  4. · Enabling SSI (Server-Side Includes)
  5. · Redirects
  6. · Pros and Cons

print this article
SEARCH DEVARTICLES

TOOLS YOU CAN USE

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.


blog comments powered by Disqus
JAVASCRIPT ARTICLES

- More Top jQuery Tutorials for Beginners
- More Top jQuery Plugins for Menus
- Top jQuery Tutorials for Beginners
- New UI Framework and SDK for JavaScript Rele...
- JavaScript OpenPGP Tool, Node.js 0.6.3 Avail...
- Yahoo Releases Cocktails Language and Develo...
- Customizing jQuery Slideshows: Dynamic Contr...
- Customizing jQuery Slideshows: the animate()...
- Customizing jQuery Slideshows: slideUp() and...
- Customizing jQuery Slideshows: hide() and sh...
- Web Workers: Performing Calculations in Para...
- More Top JavaScript Frameworks and Libraries
- More Dynamic jQuery Styling Techniques
- The Top JavaScript Libraries
- The Top JavaScript Frameworks

Dev Articles Forums 
 RSS  Articles
 RSS  Forums
 RSS  All Feeds
Weekly Newsletter
 
Developer Updates  
Free Website Content 
Contact Us 
Site Map 
Privacy Policy 
Support 



© 2003-2012 by Developer Shed. All rights reserved. DS Cluster 11 - Follow our Sitemap
Popular Web Development Topics
All Web Development Tutorials