Use Lowercases For All Files

Standards are what keep everyone in line, and in sync. Without them your organization will be like a headless chicken…. running around without any idea what it is doing. Unfortunately, many PHP-specific standards are too addicted to what I like to call: mixed caps madness. Some ignorant fool in front of his computer decided this would be a good idea:


Can someone explain to me how that makes sense? After nearly 10 years of PHP development I still cannot figure it out. All I see is an oncoming headache caused by the mixed cases. Most PHP-friendly servers are Linux based, and use case-sensitive file systems. As a result this can cause a lot, and I do mean a lot, of headaches. It makes far more sense to keep all files the same… lowercase. The number of times I have encountered issues due to mixed-case standards is ridiculous.

For the love of all that is binary, let’s put an end to this mixed-case bullshit and keep all source files lowercase.

Read More

The Downside Of Encrypted Search

Back when Google first introduced SSL search I loved it, and thought it was a great idea. The problem is now that I’m getting back into Internet marketing I am finding myself much more conflicted about it.

The basic idea behind SSL search was simple – let people use Google but hide their activity. That makes sense. There’s one big flaw, however, and here it is:

downside of encrypted search

Yep, it hides a good chunk of my keyword data. That’s annoying. It makes SEO a whole lot more difficult. Then again… perhaps that is what they wanted? A way to force marketers to stay on their tip-toes?

But I digress; that image is a major downside of encrypted search. That said, do I think the privacy benefits are worth it? Sure! Would it be nice if Google provided some simpler ways of doing keyword analysis with 3rd-party tools (like you could before)? Hell yeah!

Read More

So How Does That WordPress Htaccess Work?

WordPress LogoHave you ever wondered what that WordPress-generated .htaccess file actually does? This post gives you a quick line-by-line rundown of the file.

Before we begin we should go over mod_rewrite, the Apache module that WordPress relies on. Mod_Rewrite basically lets you rewrite one url to another. You can perform simple page redirects, point virtual/fake paths to a specific file (like WordPress does), or even redirect your non-www site to www.

Mod rewrite is used by WordPress to create your URL slugs – like /topics, /about, etc. These paths do not correlate to physical files on your server, instead the paths are passed to a single file (index.php), which will use the WordPress database to figure out what to load.

For reference, here is the code generated on this very install of WordPress:

# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
# END WordPress

Here’s a breakdown of each line:

  • Lines 2 and 9 – The IfModule lines (at the top and buttom) both check that the mod_rewrite Apache module is activated. If it was not activated and these lines were not in place – you would have server error-galore.
  • Line 3 – Turns on the rewrite engine.
  • Line 4 – This basically tells your server that the URLS are at the server root, rather than inside a folder.
  • Line 5 – Don’t rewrite requests to index.php. [L] Tells it to stop here.
  • Line 6 and 7 – Don’t rewrite the URL if it is going to an actual file (images, css files, directories, etc).
  • Line 8 – All other requests (“fake URLs” “slugs” etc) will goto index.php. WordPress finds out what page you requested via a server variable called REQUEST_URI.
Read More

Quick’N’Dirty Weighted Link Rotation Script

Over the years I’ve worked with numerous clients who have needed this same basic script for their sites – a link rotator. Here is a dumbed-down version of the code that I use:

//add links here
//format: "link_url" => weight
$links = array(
$expanded = array();
foreach($links as $link=>$weight) {
	for($i = 0;$i < $weight;$i++) {
		$expanded[] = $link;
$link = $expanded[array_rand($expanded)];
echo $link . PHP_EOL;

To add a link simply append it to the $link array, using the same format as the existing links. The weights have to be whole numbers. It is really simple – if you have two links with weights of 4 and 2 – that means the link with a weight of 4 will be shown twice as much as the 2.

Read More

Silly Google Algorithms, Gordon Ramsay Is Not Beethoven!

This one stumps me. Really. So here I was, surfing YouTube (as any true blooded modern-day geek does after a long day of work), and I came upon one of Beethoven’s symphonies. I listened for a few minutes, then looked upon the sidebar and saw this:


Now, I’m not really sure why that happened. Gordon Ramsay is about as far from Beethoven as you can get. I mean, they sort of *look* alike (crazy hair, mean face), so perhaps there is some facial recognition thing going on? Even weirder – there was a link for a sushi video right under it.

My algorithm-orientated mind is having a really hard time trying to figure out how the heck Google thinks those videos are “related” Even weirder – when I refresh it shows a different video of Gordon Ramsay each time, but all the other “related” videos remain exactly the same.

Sometimes you just gotta love Google quirks.

Read More