Home arrow JavaScript arrow Page 4 - 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 - Enabling SSI (Server-Side Includes)
(Page 4 of 6 )

How many pages do you have in your website? Maybe a few dozen, right? And every page has the same header, navigation menu, footer and copyright information. What will you do if you want to add a menu item? It’s a nightmare for you, right? If you use SSI, you just make the modification once and all pages will be changed. Does that sound useful?

Okay, let’s do it.

AddType text/html .shtml

AddHandler server-parsed .shtml

The above directives indicate that files with the .shtml extension are the text/html type and will be parsed by the server.

For example you have a page in your products - products.shtml:

<html>

<head>

..

</head>

<body>

<!--#include virtual=”include/header.html”-->

.

<!--#include virtual=”include/menu.html”-->

<!--#include virtual=”include/footer.html”-->

</body>

</html>

Blocking, Changing and Redirects

When you find somebody whom wants to hack your site, that’s okay, just block his IP or an IP range.

order deny, allow

deny from 10.133.11.110

deny from 10.188.

allow from all

The above snippet directive will block requests from IP 10.133.11.110 and an IP address that begins with 10.188.

Consider that you are using a JSP script to create your dynamic website, and will be adding index.jsp to the default directory welcome page.

DirectoryIndex index.htm index.html index.shtml index.jsp default.cgi

By configuring the above directive in your .htaccess file, when a request comes to a directory, the server will attempt to locate the files from left to right as the default directory page.


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