The Definitive Guide to Apache mod rewrite Book TOC – Free Books Download PDF

The Definitive Guide to Apache mod rewrite Book TOC – Free Books Download PDF
Download PDF Click Here

CHAPTER 1 An Introduction to mod_rewrite                          

When to Use mod_rewrite

“Clean” URLs

Mass Virtual Hosting

Site Rearrangement

Conditional Changes

Other Stuff

When Not to Use mod_rewrite

Simple Redirection

More Complicated Redirects

Virtual Hosts

Other Stuff

Summary

CHAPTER 2 Regular Expressions                                       

The Building Blocks

Matching Anything (.)

Escaping Characters (\)

Anchoring Text to the Start and End (^ and $)

Matching One or More Characters (+)

Matching Zero or More Characters (*)

Greedy Matching

Making a Match Optional (?)

Grouping and Capturing ( () )

Matching One of a Group of Characters ([ ])

Negation (!)

Regex Examples

Email Address

Phone Number

Matching URIs

Regex Tools

Rebug

Regex Coach

Summary

CHAPTER 3 Installing and Configuring mod_rewrite                 

Third-Party Distributions

Installing mod_rewrite

Static vs Shared Objects

Installing from Source: Static

Installing from Source: Shared

Enabling mod_rewrite: Binary Installation

Testing Whether mod_rewrite Is Correctly Installed

If You’re Not the System Administrator

Enabling the RewriteLog

Summary

CHAPTER 4 The RewriteRule Directive                                

Introducing RewriteRule

RewriteRule Syntax

RewriteRule Context

Rewrite Target

RewriteRule Flags

CHAPTER 5 The RewriteCond Directive                               

RewriteCond Syntax

RewriteCond Variables

Time-Based Redirection

RewriteCond Additional Variables

Image Theft

RewriteCond Pattern

Examples

RewriteCond Modifier Flags

Looping

Summary

CHAPTER 6 The RewriteMap Directive                                

RewriteMap Syntax

Map Types

txt Map Files

Randomized Rewrites

Hash-Type Maps

External Programs

Internal Functions

Summary

CHAPTER 7 Basic Rewrites                                            

Adjusting URLs

Problem: We Want to Rewrite Path Information

to a Query String (Example 1)

Problem: We Want to Rewrite Path Information

to a Query String (Example 2)

Problem: We Want to Rewrite Path Information

to a Query String (Example 3)

Problem: We Have More Than Nine Arguments

Renaming and Reorganization

Problem: We’ve Switched from ColdFusion to

but We Want All Old URLs to Continue Working

Problem: We’re Looking in More Than One Place for a File

Problem: Some of Our Content Is on Another Server

Problem: We Require a Canonical Hostname

Problem: We’re Viewing the Wrong SSL Host

Problem: We Need to Force SSL

Summary

CHAPTER 8 Conditional Rewrites                                      

Looping

Date- and Time-Based Rewrites

Problem: We Want to Show a Competition Website

Only During a Competition

Redirecting Based on Client Conditions

Problem: We Want to Redirect Users Based on Their

Browser Type

Problem: We Want to Send External Users Elsewhere

Problem: We Want to Serve Different Content

Based on the User’s Username

Problem: We Want to Force Users to Come Through

the Front Door

Problem: We Want to Prevent Users from Uploading

PHP Files to an Unload Area and Then Executing Them

Problem: The Client Certificate Validation Error Message

Is Indecipherable

Summary

CHAPTER 9 Access Control                                            

When Not to Use mod_rewrite

Address-Based Access Control

Environment Variable–Based Access Control

Access Control with mod_rewrite

Problem: We Want to Deny Access to a Particular Directory

Problem: We Want to Deny Access to Several Directories

at Once

Simple Client-Based Access Control

Problem: We Want to Block a Spider from Hammering

Our Website

Problem: We Want to Prevent “Image Theft”

Summary

CHAPTER 10 Virtual Hosts                                                

Virtual Hosts the Old-Fashioned Way

Configuring Virtual Hosts with mod_vhost_alias

www.example.com works, but example.com Doesn’t

There Are Too Many Directories

This Approach Breaks My Other Virtual Hosts

Logging

It’s Too Inflexible

Mass Virtual Hosting with mod_rewrite

Rewriting Virtual Hosts

Virtual Hosts with RewriteMap

Logging for Mass Virtual Hosts

Splitting the Log File

Using Piped Log Handlers

Summary

CHAPTER 11 Proxying                                                   

Proxy Rewrite Rules

Security

Apache 1.3

Apache 2.0

Proxying Without mod_rewrite

Proxying with mod_rewrite

Proxying a Particular File Type

Proxying to an Application Server

Modifying Proxied Content

Excluding Content from the Proxy

Looking Somewhere Else

Summary

CHAPTER 12 Debugging                                                

RewriteLog

A Simple RewriteLog Example

Loop Avoidance

RewriteRule in .htaccess Files

Regex Building Tools