September 19, 2006

ModRewrite for Apache and IIS

There's a lot of ModRewrite tutorials out there, but I always had a hard time finding a pretty clear cut explanation for the most common uses: redirecting and making search engine friendly URLs out of query string dynamic ones. Finding a simple laid out example was always a bear as well. A friend recently asked me for a rundown on using ModRewrite for both Apache and IIS servers and I wrote out a pretty good email explanation and thought, hey, perfect blog post. So here goes:

"Rewrite" is a misleading term, nothing it really getting rewritten so to speak. What is happening is you are putting a matching statement first and then what content to serve. This statement sorta says, "If someone asks for this URL, then show them the content that would get served with this address". When you throw a 301 modifier at the end you say, "If someone asks for this URL, give them this content by redirecting them to it."

For Apache you would put something like the following in your .htaccess file. You can proceed a line with # to make it a comment or note that doesn't get processed:

# Something for Apache that is required for ModRewrite module to work
Options +FollowSymLinks

# Duh
RewriteEngine on

# Everything that follows is in relation to the root
RewriteBase /

# Redirecting via a 301 to a new page, ^ starts the match phrase to look for, $ ends it
RewriteRule ^RequestedPage\.html$ /GetBouncedHere.html [NC,R=301,L]

# This is the traditional ModRewrite for search engine friendly URLs
RewriteRule ^([a-zA-Z0-9]+)/pictures/([0-9]+)\.html$ /yourcode.php?type=pictures&forwho=$1&recID=$2 [NC,L]


NC means "no case" specific matching, R=301 is the type of redirect to use, L means this is the last rule, after running this stop and server the page. Inside parenthesis go your variables, things that can change. You have to declare what type of characters these can be, in this case, alpha numerical of either case. The + at the end means an infinite number of character would be allowed, without it it means one character of those types. For each set in parenthesis you plug a $1, $2, $3, etc... into where that variable needs to go into your dynamic URL. They don't have to be in order, you could call $2 before $1. The above would allow you to do something like /joemama/pictures/28.html and serve up a dynamic page that pulls in the record ID 28 from the pictures database for joemama, etc... Because we left out the R=301 we get a "Rewritten" URL instead of being permanently redirected.

For IIS it's the same concept just slightly different syntax and it goes in the httpd.ini file:

[ISAPI_Rewrite]

RewriteRule /OldPage\.html /NewPage\.html [I,RP,L]

RewriteRule /doc(.*)\.html /yourcode.asp\?document=$1 [I,L]



Just about the same except your have to escape (use \ ) on both ends, don't need the ^ and $ to mark the beginning and end of phrase matches. The modifiers at the end differ slightly, L is the same, I means Ignore case, and RP is redirect permanent. Everything else is nearly identical.

Note: Technically in Apache you can use [a-zA-Z0-9] and (.*) interchangeable, but by limiting the type of characters people can try and stick in the URL which gets passed into your query for your database, you prevent errors and security breaches. That's why Apache has that method available and is preferred, at least I think so.

The best tutorials and info on these I have found are:

September 05, 2006

MSN AdCenter Surveys

Has anyone else done the online survey MSN AdCenter sent out a few weeks ago? The 6 minute promised survey took more like 30 and the promise of an Amazon gift certificate never materialized. I figured par for the course with those guys, but then they have to gall to send out a notice that they have hired Ipsos Loyalty to conduct a phone survey and I should be expected a call from them over the coming weeks. Problem is I got about 20 of these, one for each client that I'm testing MSN for. Should I expect 20 survey calls whether I want them or not now? Maybe I'll just read them my last post about how much they are doing wrong and then ask them where my certificate is, 20 times.

August 24, 2006

Premium Turnkey Integrated Modular System Solutions

Sometimes when people think about their products internally and how they are described, there is a disconnect from what their customers might call them. An example would be a company who says they sell "spacial access systems" when in fact their customers just know them as "doors". Okay, that's an extreme example, but the point is, what you as a business may call your product and what those seeking it call them often can differ greatly. Unless your target audience are versed in these terminologies, companies need to take a hard look at those habits, identify the vague industry insider nomenclatures and abandon them forever. This gets your habits moving in the right direction, calling your products what people might be searching for in everything you do online, links, copy, menus, etc... and your keyword relevancy and search rankings will thank you.

There are also some really really bad habits companies have of naming products and services that are not industry specific, that are so universal that they truly mean nothing. Some good examples are the phrases "turnkey solution" or "modular systems". These mean nothing, not a single thing. Sure, they identify a vague concept, a general way of thinking or approach, but are you selling vague notions? The answer 99.9% of the time is going to have to be absolutely not. So using these phrases in describing your products, how do you ever expect to be found among not only your competitors in your industry, but among every player in every other industry in every market on the planet? That's pretty ambitious and not exactly worth the effort it would have to take. Seriously, this is like trying to rank for "widgets". Why do it? Abandon these all encompassing terms, don't be lazy in naming what you do, get specific, use the research you have, ask your customers to describe your products. This is one of those many cases where board members don't know best. If you ever find yourself describing your offerings in one of those meaningless vague phrases, stop immediately. Those bad habits will spill over into your online marketing and you will fail to connect to your customers.

"But this is what my customers call them," you might say, and that may be true enough. But if they hit the search engines and try their vague phrase and get the random unrelated junk that is inevitably going to be spit back out at them, you can bet your last dollar that they are going to qualify that search term and get a better result. THAT is where you want to be found. So, by putting your SEO efforts on terms like this, you not only give yourself a better chance for success, you also end up with a better more qualified pool of traffic. That means better conversion rates, and THAT is what you are doing this all for. Remember, it's not broad rankings and traffic that counts, but conversions!