JavaScript
  Home arrow JavaScript arrow Page 5 - 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  
Moblin 
JMSL Numerical Library 
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 - Redirects


    (Page 5 of 6 )

     

    The last feature of widespread use is the Redirect. Redirect is the most useful feature that .htaccess provides, either on the same server, or on a completely different web site. It can be extremely useful if you change the name of one of your files but still allows users to find it. Another use, which I find very useful, is to redirect to a longer URL, for example:

    Redirect /jump/url1.ext http://www.otherlongsite.com/new/file/locations.xyz

    To show you another example, let us suppose that your current web site domain is yoursite.com and now you registered another domain at yoursite.net, and you expect any requests to yoursite.net will be forwarded to yoursite.com. This means the whole site redirects, so you need to add a "follow" directive to the .htaccess and place it at the root of yoursite.net.

    Redirect / http://www.yoursite.com/


    When a user requests a URL, e.g. http://www.yoursite.net/news/daily.html, the browser address will be forwarded to http://www.yoursite.com/news/daily.html. Also a request for http://www.yoursite.net/album/index.jsp will be forwarded to http://www.yoursite.com/album/index.jsp.

    Meta tag redirection

    Now you have seen the basic functionalities that .htaccess provides, let us talk about another way to redirect by the use of Meta tags.

    Here is an example index.html:


    <html>

    <head>

    <title>Welcome</title>

    <meta http-equiv=”refresh” content=”5; url=http://www.newsite.com/” />

    </head>

    <body>

    This page has moved.<br />

    Please follow the link to the new location<a href=”http://www.newsite.com”>http://www.newsite.com/</a>

    </body>

    </html>



    Your old site’s home page would be updated with the above code. All users coming to the root of the old site will be automatically forwarded to the new site,  http://www.newsite.com after 5 seconds.

    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 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
    - Ajax Hack for Entering Information Without R...
    - EXT JS 2.1 Overview
    - Using the Style Object for Zebra Tables with...
    - Binary Searching
    - An Improved Approach to Building Zebra Tables






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