mod_rewrite And Friends¶
Contents
- 1. Regular Expressions
- 1.1. The Building Blocks
- 1.2. Matching anything
- 1.3. Escaping characters
- 1.4. Anchoring text
- 1.5. Matching one or more characters
- 1.6. Matching zero or more characters
- 1.7. Repetition quantifiers
- 1.8. Greedy Matching
- 1.9. Making a match optional
- 1.10. Grouping and capturing
- 1.11. Backreferences
- 1.12. Character Classes
- 1.13. Negation
- 1.14. Regex examples
- 1.15. Regex tools
- 1.16. RewriteRule generators
- 1.17. Summary
- 2. URL Mapping
- 3. Introduction to mod_rewrite
- 3.1. Where mod_rewrite fits in the request lifecycle
- 3.2. How mod_rewrite interacts with other modules
- 3.3. What are .htaccess files?
- 3.4. Ok, so, what’s the deal with mod_rewrite in .htaccess files?
- 3.5. So, what do I do?
- 3.6. Inherit and InheritBefore
- 3.7. InheritDown and InheritDownBefore
- 3.8. IgnoreInherit
- 3.9. AllowNoSlash
- 3.10. AllowAnyURI
- 3.11. MergeBase
- 3.12. IgnoreContextInfo
- 3.13. LegacyPrefixDocRoot
- 3.14. LongURLOptimization
- 4. RewriteRule
- 5. Rewrite Logging
- 6. RewriteRule Flags
- 6.1. B - escape backreferences
- 6.2. BNP - backrefnoplus
- 6.3. BCTLS
- 6.4. BNE
- 6.5. C - chain
- 6.6. CO - cookie
- 6.7. DPI - discardpath
- 6.8. E - env
- 6.9. END
- 6.10. F - forbidden
- 6.11. G - gone
- 6.12. H - handler
- 6.13. L - last
- 6.14. N - next
- 6.15. NC - nocase
- 6.16. NE - noescape
- 6.17. NS - nosubreq
- 6.18. P - proxy
- 6.19. PT - passthrough
- 6.20. QSA - qsappend
- 6.21. QSD - qsdiscard
- 6.22. QSL - qslast
- 6.23. R - redirect
- 6.24. S - skip
- 6.25. T - type
- 6.26. UnsafeAllow3F
- 6.27. UnsafePrefixStat
- 6.28. UNC
- 7. RewriteCond
- 8. RewriteMap
- 9. Proxies and mod_rewrite
- 10. Virtual hosts and mod_rewrite
- 11. Access control with mod_rewrite
- 12. Conditional Configuration
- 13. Content Munging
- 14. Recipes
- 14.1. Common Redirects
- 14.2. Clean and Pretty URLs
- 14.3. Access Control
- 14.4. Proxying
- 14.5. Query String Manipulation
- 14.6. Edge Cases and Gotchas
- 14.6.1. Diagnosing and Fixing Rewrite Loops
- 14.6.2. .htaccess vs. Server Config Context Differences
- 14.6.3. Rule Ordering and the [L] Flag
- 14.6.4. Debugging Rewrite Rules with the Rewrite Log
- 14.6.5. Serving a Fallback Resource When a File Is Missing
- 14.6.6. Maintenance Mode (503 Service Unavailable)
- 14.6.7. Handling Special Characters and Encoded URLs
- 14.6.8. Performance with Large Numbers of Redirects
- 14.7. When NOT to Use mod_rewrite
- 14.7.1. Simple Redirects: Use Redirect, Not RewriteRule
- 14.7.2. Proxying: Use ProxyPass, Not RewriteRule [P]
- 14.7.3. Conditional Logic: Use <If> Expressions
- 14.7.4. Fallback Resources: Use FallbackResource, Not RewriteRule
- 14.7.5. Advanced: Using RewriteMap for Dynamic Rewrites
- 14.7.6. Advanced: IP Range Matching with RewriteMap
Back Matter
- Glossary
- List of Epigraphs
- Preface
- Chapter 1: Regular Expressions
- Chapter 2: URL Mapping
- Chapter 3: Introduction to mod_rewrite
- Chapter 4: RewriteRule
- Chapter 5: Rewrite Logging
- Chapter 6: RewriteRule Flags
- Chapter 7: RewriteCond
- Chapter 8: RewriteMap
- Chapter 9: Proxies and mod_rewrite
- Chapter 10: Virtual hosts and mod_rewrite
- Chapter 11: Access control with mod_rewrite
- Chapter 12: Conditional Configuration
- Chapter 13: Content Munging
- Chapter 14: Recipes