WP-Mix

A fresh mix of code snippets and tutorials

Category Archive: .htaccess

Posts about Apache and .htaccess

Page 3 of 4

Simple Ajax Chat .htaccess whitelist

In general, chat scripts are huge targets for malicious activity. My chat plugin, Simple Ajax Chat is no exception, and includes strong security measures to protect against attack.

Quick KB/MB unit conversions

Working with .htaccess for stuff like file uploads, it’s frequently necessary to convert between kilobytes and megabytes.

Force download WMV with .htaccess

Everyone loves WMV! Not! Jokes aside, here’s what finally worked for me when trying to force download Windows Media Video (WMV) files.

Shortcut to WP Login

Back in January of 2011, Chris Coyier posted a sweet .htaccess technique for setting up Simpler Login URLs in WordPress. This is a follow-up technique that’s slightly improved..

Additional file-types for mod_expires

Here is a list of the most common file-types for Apache’s mod_expires, which is used for configuring expires headers for better cache control.

Redirect URLs with .htaccess

Here is a quick cheat-sheet for redirecting URLs with .htaccess.

Maintenance mode via .htaccess

For WordPress users there are at least three great plugins that make maintenance mode just dead-simple. Even so, here is how to do it with .htaccess.

Canonical snippets for WordPress

.htaccess enables us to easily clean up 404 errors and other misdirected HTTP traffic for better SEO. Here are some canonical snippets for WordPress and beyond.

Redirect HTTP to PHP via .htaccess

Here is how to redirect specific URL requests to a PHP script for further processing, etc. Very useful for monitoring HTTP activity, logging errors, and more.

Redirect HTTP to HTTPS

In addition to www canonicalization, you can also canonicalize the HTTP protocol, redirecting HTTP to HTTPS (or vice versa) with .htaccess.

.htaccess for Apple Touch Icons

Devices and bots are often searching for different versions of the Apple Touch Icon. Here is a quick slice of .htaccess to redirect all apple-icon requests to apple.png.

Allow access to external IPs during development

When developing sites, an easy way to keep things private is to use .htaccess to restrict access based on IP address.