«    »

Saving old .php files and www to non www with ISAPI_Rewrite

04.10.2008     Comments     Related    
Tonight I was checking page rank, looked at referrals in Google Analytics and was browsing around in Google Webmaster Tools along with other geeky spring site cleaning stuff.
 

I noticed a lot of old URL's pointing to .php files from my php days. People visiting my site would get a big fat "Page Not Found" before. To remedy the situation I created a standard 404.html to use as a landing page that IIS would direct to. I keep this 404.html updated by pulling all blog/photo records and then I "build" this page using cfsavecontent and cffile to write to the file.

That's all good and dandy and I started to notice my stats going way up right away. Now I am able to "capture" these referrals through analytics. However, I thought I could do slightly better. Enter ISAP_Rewrite.

Luckily, my beloved host has ISAPI_Rewrite installed so I can leverage the power of URL manipulation similar to Apache's mod_Rewrite. Sure this could probably be done in IIS but I don't have access and it seems easier to handle this on a site-by-site basis using a httpd.ini file for each domain.

The end result will be a user who doesn't experience any rough waves while surfing (or attemting to surf, in this case) my site. Here is the rule if you're interested. This goes in the root directory, name the file httpd.ini. See the ISAPI_Rewrite docs for a full list of instructions.

# Rewrite old php file to new coldfusion file RewriteRule /extras/2006/02/diy_lightbox.php /blog/detail.cfm/post/19 [I,O]

I was able to find about 10 or 15 old pages that were pretty heavy on my referral list, including 503 visits in the last month from studiolighting.net that before today I would have missed. If you're wondering how I knew it was in the last month, google just rolled this feature out.

You might not have ISAPI_Rewrite installed. If that's the case, check out this site that has examples for all cases (Apache/.htaccess for instance). Here is another good site too.

Another thing on my to-do list was to direct all of my www's to non www's. For example http://www.jyoseph.com to http://jyoseph.com. I wanted to do this to avoid splitting page rank between the two sites. It's sort of confusing to me still but I'm doing it for good measure.

#Rewrite www to non-www RewriteCond Host: ^www.jyoseph\.com RewriteRule (.*) http\://jyoseph\.com$1 [I,RP]
Date: 04.10.2008
Tags: website   rewrite   jyoseph.com  
Share: Ping This! Add to Delicious Add to Digg Add to Newsvine Add to Reddit Add to technorati Add to Yahoo Add to Spurl Add to Smarking Add to Magnolia

Comments

blog comments powered by Disqus

Possibly Related

 
Like what you see? Snag my blog feed and stay up to date. Check out all of my site feeds here.

Back Up