Table of Contents
-
Introduction
- Htaccess - Evolved
- AskApache Htaccess Journey
- What Is .htaccess
- Htaccess File Syntax
- Htaccess Directives
- Main Server Config Examples
-
Example .htaccess Code Snippets
- Redirect Everyone Except IP address to alternate page
- When developing sites
- Fix double-login prompt
- Set Timezone of the Server (GMT)
- Administrator Email for ErrorDocument
-
ServerSignature
forErrorDocument
- Charset and Language headers
- Disallow Script Execution
- Deny Request Methods
- Force "File Save As" Prompt
- Show CGI Source Code
- Serve all .pdf files on your site using .htaccess and mod_rewrite with the php script.
- Rewrite to www
- Rewrite to www dynamically
- 301 Redirect Old File
- 301 Redirect Entire Directory
- Protecting your php.cgi
- Set Cookie based on Request
- Set Cookie with env variable
- Custom ErrorDocuments
- Implementing a Caching Scheme with .htaccess
- Password Protect single file
- Password Protect multiple files
- Send Custom Headers
- Blocking based on User-Agent Header
- Blocking with RewriteCond
- .htaccess for mod_php
- .htaccess for php as cgi
- Shell wrapper for custom php.ini
- Add values from HTTP Headers
- Stop hotlinking
- Example .htaccess Files
-
Advanced Mod_Rewrites
- Directory Protection
- Password Protect wp-login.php
- Password Protect wp-admin
- Protect wp-content
- Protect wp-includes
- Common Exploits
- Stop Hotlinking
- Safe Request Methods
- Forbid Proxies
- Real wp-comments-post.php
- HTTP PROTOCOL
- SPECIFY CHARACTERS
- BAD Content Length
- BAD Content Type
- Missing HTTP_HOST
- Bogus Graphics Exploit
- No UserAgent, Not POST
- No Referer, No Comment
- Trackback Spam
- Map all URIs except those corresponding to existing files to a handler
- Map any request to a handler
- And for CGI scripts:
- Map URIs corresponding to existing files to a handler instead
- Deny access if var=val contains the string foo.
- Removing the Query String
- Adding to the Query String
- Rewriting For Certain Query Strings
- Modifying the Query String
-
Best .htaccess Articles
- .htaccess for Webmasters
- Mod_Rewrite URL Rewriting
- 301 Redirects without mod_rewrite
- Secure PHP with .htaccess
- .htaccess Cookie Manipulation
- .htaccess Caching
- Password Protection and Authentication
- Control HTTP Headers
- Blocking Spam and bad Bots
- PHP htaccess tips
- HTTP to HTTPS Redirects with mod_rewrite
- SSL in .htaccess
- SetEnvIf and SetEnvIfNoCase in .htaccess
- Site Security with .htaccess
- Merging Notes
- My Favorite .htaccess Links
- Htaccess Directives
- Htaccess Variables
- Htaccess Modules
- Htaccess Software
- Technical Look at .htaccess
For Help see HTaccess.guru