Jan 13 2012

A Guide to the Best Htaccess mod-rewrite Resources on the Web

Category: serverUlrich Palha @ 1:30 pm

Overview

In one of my earlier posts I covered basic use of .htaccess and mod_rewrite. If you have shared hosting using Apache and want to create SEO friendly URLs, redirect old URLs to new, stop image hotlinking, restrict access to your site’s content or any one of the many things that are demanded of you as as a webmaster, then .htaccess and mod_rewrite offer you this and a whole lot of other functionality.

But all this functionality and flexibility has its drawback: complexity – Apache Mod_Rewrite Documentation

Fortunately, there are a number of good resources on the web, and a couple of books that help you understand all you need to know about .htaccess and mod_rewrite

.Htaccess Tutorials and cookbooks

  1. Askpache.com: the ultimate htaccess

  2. Askpache is the most comprehensive site that I have found on .htaccess and mod_rewrite.
    It covers everything from beginner to very advanced .htaccess use to SEO. There are a lot of examples that you can use as a start to writing your own .htaccess rules.

    Click to view Table of Contents from AskApache.com.

  3. Perishable Press Stupid Htaccess tricks

  4. Stupid Htaccess tricks is also a very comprehensive site that covers everything from beginner to advanced .htaccess use. It also has a lot of examples that are explained with simple language.

    Click to view Table of Contents from Perishable Press Stupid htaccess Tricks.

  5. Apache’s rewriting guide

  6. Together with the Apache Mod-Rewrite Documentation, this is where most people eventually refer to for specific details. If you do not have a technical (developer, sysadmin etc) background, then you may want to approach one of the beginner guides first.

    Click to view Table of Contents from Apache's rewriting guide.

  7. Easymodrewrite.com

  8. This has introductory .htaccess material and is good for beginners.
    Click to view Table of Contents from easymodrewrite.com.

  9. Htaccessguide.com

  10. This is also a good site for beginners, and it covers some common use cases.
    Click to view Table of Contents from Htaccessguide.com.

  11. 21 htaccess tips

  12. This is less of a tutorial and more of a cookbook for specific htaccess needs.
    Click to view Table of Contents from 21 htaccess tips.

    Other Web Resources

    Htaccess cheat sheet with RewriteRule/rewriteCond flags, server variables etc. Assumes you already know .htaccess.
    SEO 301 Redirect Examples gives you an SEO perspective on .htaccess.
    Click to view Table of Contents from SEO 301 Redirect Examples.


    View servervariables on a page to see how the URL maps to each one.
    Server faults guide to mod-rewrite Covers some common examples of RewriteRule and RewriteCond
    Excellent Regular expression guide This is the best online resource for learning regular expressions.

    Books

    Mastering Regular Expressions by Jeffrey Friedl – this is the best book to read if you want to fully master regular expressions and understand how the various regex engines work.
    The Definitive Guide to Apache mod_rewrite: this book is a gentler introduction to mod_rewrite than the online Apache docs and also has plenty of examples.

    Questions about .htaccess or mod_rewrite

    If you have questions about .htaccess or mod_rewrite that are not covered in any of the resources listed, then you can post a question on Stackoverflow or Serverfault.

    Know of other great .htaccess/mod_rewrite resources

    If you know of other great .htaccess or mod_rewrite resources on the web, please let me know.

    Tags: , , ,