Image Image Image Image Image
Scroll to Top

To Top




Information Resources


By admin404

Twitter Cards and WordPress

May 19, 2015 - Information Resources

In our “Twitter CardsInformation Resource (February 2013), we shared with you a step-by-step guide for setting up your meta-tags, testing, and applying to Twitter to implement Twitter Cards into your WordPress site. Over the last two years, we’ve updated our process to best suit our clients who want to refine Twitter Card content for their WordPress sites, and overcome the limitations of sites with AJAX-loaded content, which was previously impossible with Twitter.

Read More

Tags | .htaccess, ajax, ajax-loaded, dynamic content, lazy load, php, tips, tutorial, twitter, twitter cards, wordpress



Information Resources


By admin404

Apache Mod_Rewrite for Vanity URLs

March 5, 2013 - Information Resources

Ever wondered how web services like Twitter (, Facebook (, and MySpace (currently: are able to serve vanity URLs for their numerous users? The answer is in the rewrite.

Working with URL rewriting (namely: Apache’s mod_rewrite, a rule-based rewriting engine) can be a little bit confusing. LiquidWeb Hosting’s stellar technical support team passed the inquiry from tech-to-tech before a solution was found. This solution was further polished by ERA404 systems guru, Tony Muka, and is explained below.

What are the rules?

We mentioned “rule-based” when describing this Apache module. So what are the rules?

1. Ignore files that already exist on your web-space (index.htm, logo.png, and so on).

RewriteCond %{SCRIPT_FILENAME} !-f

2. Ignore directories that already exist on your webspace, too (image folders, script folders, and so on).

RewriteCond %{SCRIPT_FILENAME} !-d

3. For everything else, let’s pass anything after the base URL as an argument to your backend script to do whatever magic you wish to do. Now this is the confusing part because (unlike the previous two rules) it’s written in something that looks like Q*bert gibberish. Let’s have a look at that last rule.

RewriteRule ^([^/]+)/?(.*)$ /?user=$1&$2

Notice that this rule starts with “RewriteRule” and not “RewriteCond[ition]”. This is where we ask Apache to rewrite the URL if the first two conditions aren’t met—that is to say, it will only rewrite URLs for non-existent files and directories. Here’s a little breakdown of what will happen when you’ve put this instruction set on your web server:

This Requested URL Rewrites to Because (no rewrite) …this file actually exists (no rewrite) …this directory actually exists No file or directory exists
named “username”
No file or directory exists
named “username”

With this last requested URL, you can see the power of Apache’s mod_rewrite, because we can technically provide instruction for your handler scripts to do anything you need them to do. In this usage, a username is passed, as well as an action to present the profile page. This methodology can be used in countless scenarios where a long, cumbersome URL can be compacted, such as REST requests, XML requests, and so on.

Putting it All Together

# address translation for user URLs
RewriteEngine on
RewriteBase /
# look for url/username or url/username/ and translate to url/?user=username
# maintain all other passed arguments
RewriteCond %{SCRIPT_FILENAME} !-f
RewriteCond %{SCRIPT_FILENAME} !-d
RewriteRule ^([^/]+)/?(.*)$ /?user=$1&$2

Simply put this script into a text document, name it “.htaccess” and drop it into your webserver’s root directory. Make sure that Apache’s mod_rewrite module is activated on your HTTP server’s configuration (it usually is), and you’ll be all set to rewrite some URLs.


Tags | .htaccess, apache, engine, mod, request_filename, REST, rewrite, rewritecond, rewriteengine, rewriterule, script_filename, uniform resource locator, url, xml



Information Resources


By admin404

Disabling Caching with .htaccess

October 23, 2012 - Information Resources

For our friends and fellow designers who would rather not have to perpetually clear browser cache while fine-tuning CSS, Actionscript, ads or procedural images, you might want to have a look at the following apache/.htaccess directive:

<filesMatch "\.(html|htm|js|css)$">
FileETag None
<ifModule mod_headers.c>
Header unset ETag
Header set Cache-Control "max-age=0, no-cache, no-store, must-revalidate"
Header set Pragma "no-cache"
Header set Expires "Wed, 11 Jan 1984 05:00:00 GMT"

This little trick, courtesy of AskApache, here:

Tags | .htaccess, apache, browser, caching, clear, conf, disable, httpd, perpetual, persistent