Follow-up on Datafeeds Podcast

by on March 4, 2010

Pin It

I was listening to the “both sides of the tracks” podcast about Sports Marketing, Datafeeds and Traffic Geyser that Jason, Joe & I recorded earlier this week, and realized I forgot a point that I wanted to cover.

Joe was talking about a custom script he had written which generated tens of thousands of HTML pages on his server (one per product). We then jumped into PopShops and DataFeedr, completely skipping over how I handle datafeeds! So I’m writing this blog post to outline another solution.

By using .htaccess, PHP and a database, you can save the datafeed in your MySQL database and use a single PHP file with some .htaccess magic to make it appear as though you have thousands of pages on your site.

The basic concept is you’ll have a URL, such as mydomain.com/kabusecha-plum-123.html but that file does not exist on your server! Instead, .htaccess intercepts the request, and rewrites it to a dynamic PHP file (item.php). The .htaccess will look like:

RewriteEngine On
RewriteRule (.*)\-([0-9]+).html$ item.php?nItemID=$2 [L]

What this does is finds any requests for a file that ends in -##.html (dash, any number, dot html) and tells the server what the user really meant was item.php?nItemID=## (whatever that number was). Now your item.php file connects to the database, pulls up record $_GET['nItemID'] and inserts that information in your template.

Now when you have to update your template, you update just the item.php file, and all of your “.html” files are automatically updated!

I’m in talks with Loxly on coming up with a full case study on how to effectively use datafeeds for an affiliate website.

Was this post useful? Please share it with others:

Pin It

Turn Datafeeds Into Affiliate Store In 3 Easy Steps - No HTML Knowledge

Click to play videoCustom programmed datafeed sites can be a little too mcuh for some people. That's ok! That's why there's Datafeedr.

If you think building an affiliate store was just too hard, then Datafeedr's Click & Create system is just what you've been waiting for. Even if you have no experience with web design at all, you can have your own datafeed-driven affiliate site up and running today. Watch the video NOW and see this Push-Button Store Creation System in action!

{ 2 comments… read them below or add one }

Brian Darrow March 4, 2010 at 11:10 am

Great tip Eric! I do it similarly, only I built a wordpress plugin that delivers the dynamic content via the wordpress permalink system. So, a request for:

http://www.sitename.com/category/product

is handled by index.php where the plugin analyzes the url and delivers the appropriate content.

Your way seems more portable, though.

Reply

PandaMarketer March 9, 2010 at 12:35 am

Wow, I can’t believe I missed this post. Great start.

Reply

Leave a Comment

{ 2 trackbacks }

Previous post:

Next post: