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. |