Home arrow JavaScript arrow Page 6 - 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 - Pros and Cons
(Page 6 of 6 )

Now that you have looked at the two redirect approaches using server-side .htaccess files and Meta tags, let’s discuss their pros and cons.

Pros and cons of using the Meta tag redirect:

Some pros

  • Have control over the redirection without any intervention from the system administrator.

  • You can educate the user about the site change. You can display a change notice to the user and then redirect to the new site.

Some cons

  • The redirection is only supported by certain browsers such as Internet Explorer, Firefox, and Netscape -- in other words, popular browsers only. If you plan to use a redirection page like this, you should include a link to the site so that users with browsers that do not support the Meta tag redirection can follow the link.

  • The redirection will only work for the specific page that contains the Meta tag. If the user comes into your site looking for multiple pages, you will have to create redirection pages for each of the pages on the site.

  • Some search engines may not recognize the Meta tag redirection.

Pros and cons of using a .htaccess redirect:

Some pros

  • The redirection is seamless and causes no disruption to your users.

  • You can apply redirection to one file, one directory and even whole web sites.

  • The redirection is not browser dependent.

  • The redirection can still be recognized by search engines.


Some cons

  • .htaccess only works in Apache server. That means if your website is hosted by NT server, the .htaccess file will not work.

  • .htaccess will cause server performance issues. For example, if you enabled .htaccess in your website, and a user requests http://www.yoursite.com/album/childhood/single/index.html, since you enabled .htaccess the server will try to locate the .htaccess file in the following paths:

/.htaccess

/album/.htaccess

/album/childhood/.htaccess

/album/childhood/single/.htaccess


And so, for each file access out of that directory, there are four additional file system accesses, even if none of those files are present.

Please note, however, the following security issue. If you enable .htaccess to modify server configuration, this may result in changes over which you have no control. Carefully consider whether you want to give your users this privilege.

Conclusion

If you are running sites on Apache server and .htaccess is enabled, .htaccess redirection is better than Meta redirection based on the pros and cons comparison.


DISCLAIMER: The content provided in this article is not warranted or guaranteed by Developer Shed, Inc. The content provided is intended for entertainment and/or educational purposes in order to introduce to the reader key ideas, concepts, and/or product reviews. As such it is incumbent upon the reader to employ real-world tactics for security and implementation of best practices. We are not liable for any negative consequences that may result from implementing any information covered in our articles or tutorials. If this is a hardware review, it is not recommended to open and/or modify your hardware.

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 2 - Follow our Sitemap
Popular Web Development Topics
All Web Development Tutorials