WP-Mix

A fresh mix of code snippets and tutorials

Category Archive: .htaccess

Posts about Apache and .htaccess

Page 2 of 4

Disable caching with .htaccess

Quick .htaccess snippet to disable browser caching by modifying Cache-Control, Pragma, and Expires headers. Strictly plug-n-play.

Apache Request Method Types

Here is a list of all types of Apache Request methods. GET PUT POST DELETE CONNECT OPTIONS TRACE PATCH PROPFIND PROPPATCH MKCOL COPY MOVE LOCK UNLOCK VERSION_CONTROL CHECKOUT UNCHECKOUT CHECKIN UPDATE LABEL REPORT MKWORKSPACE MKACTIVITY BASELINE_CONTROL MERGE INVALID If you know of any others, let me know — thanks! :)

.htaccess block spammer

Quick tutorial showing how to block a specific spammer via .htaccess. This technique is perfect for forum and site owners who want to block access to pesky visitors based on their reported IP address.

.htaccess enable compression

Two quick code snippets for compressing your file output with Apache’s mod_deflate (gzip). Compressing your content is a great way to improve performance by decreasing the amount of data that is sent to the client.

Force file download with .htaccess

Here is a quick .htaccess snippet that will force files to download instead of displaying in the browser. This method works for any site running on an Apache server.

.htaccess template for custom directory views

Here is an .htaccess template for displaying a customized directory with file view enabled, such that all files except for those indicated are displayed as a list.

Protect files with .htaccess

Here are some examples of how to use .htaccess to protect any sensitive files on the server.

Limit HTTP Request Size

This .htaccess snippet can be used to restrict the total size of the HTTP request body sent from the client.

Create .htaccess files on OS X and Windows

This is a quick tutorial on how to create .htaccess files on Windows (PC) and OS X (Mac). This post also explains a bit about how .htaccess files work, and how to view them on various operating systems.

.htaccess Force GET or POST Requests

Here is how to force all HTTP requests to be either GET or POST. Easy to modify technique can be used for other types of requests as well.

Set PHP Limits with .htaccess

A quick summary of some of the PHP limits that can be set via the .htaccess file.

Browse your local files via browser

Ultra-quick tip for viewing/browsing files on your local machine in any browser.