Changing Charatcteristics of a File – Static to Dynamic

Written by Omar Kattan. Filed under Code, SEO Tips & Tricks. Bookmark the Permalink. Post a Comment. Leave a Trackback URL.

Did you know that you are able to change the characteristics of a static file such as a .html or .txt file to allow it to accept dynamic code such as php or asp?  Well you can, here’s how…

Lets say you’re looking to create a dynamic .csv  or .txt for a shopping feed for one of the shopping comparison search engines such as Shopping.com, normally, you would not be able to do so because .xml/.txt/.csv files are static and would not ordinalrily execute php commands to output the products from a database. 

The solution…

Place the following code in your .htaccess file:

<Files filename.csv>
ForceType application/x-httpd-php
</Files>

That should do the trick.  Change “filename” for your file’s name and the “.csv” to .xml, .txt or even .html depending on what you’re trying to accomplish.

Post a Comment

You must be logged in to post a comment.