JavaScript
  Home arrow JavaScript arrow Page 2 - 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 - How .htaccess can help you: Custom Error Pages


    (Page 2 of 6 )

    Here are some common uses of the .htaccess file. These will allow you to have your own personal error pages (for example when a file is not found) instead of using your host’s error pages or having no page. This will make your site seem much more professional in the unlikely event of an error.

    It will also allow you to create scripts to notify you if there’s an error. For example, you can create a JSP script on your own website to automatically e-mail you when a page is not found.

    You can use custom error pages for any error as long as you know its number (like 404 for page not found, 403 for forbidden and 500 for server internal error) by adding the following to your .htaccess file:

    ErrorDocument errorNumber /path/file.html

    For example, if I had the file not_found.html in the /errors directory of my site and I wanted to use it for a 404 error I would use:

    ErrorDocument 404 /errors/not_found.html

    Another example is if I had made a JSP script that will automatically send me an e-mail notification when a server internal error has occurred on my site, and I put the script in the path: /utility/mailer.jsp, I would use:

    ErrorDocument 500 /utility/mailer.jsp

    Additionally, you can use an external page to customize your error. For example when you found a 404 Not Found page on Yahoo, and you wrote down the URL: http://www.yahoo.com/errors/404.html, you would modify your .htaccess file content as follows:

    ErrorDocument 404 http://www.yahoo.com/errors/404.html

    With this code, when a bad request comes to your website, it will be navigated to http://www.yahoo.com/errors/404.html

    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 3 hosted by Hostway
    Stay green...Green IT