You are here:  » Page extension


Page extension

Submitted by waltonp on Tue, 2006-05-09 08:18 in

I've started to use Magic Parser for reading rss feeds. One question though, the only extension for the pages I use it on to get it to work is .php. If I save it with a .html extension the feed doesn't work. Is this normal? See www.247gigs.co.uk for a working feed.

The reason I ask is I have many other websites with pages having a .php extension in which I'd like to use Magic Parser. I don't want to change the extension for each page because they have been indexed by the search engines and the vast majority have page rank.

Thanks.

Submitted by support on Tue, 2006-05-09 08:43

Hi,

It sounds like your web server is not configured to treat .html files as PHP, which is normal - as by default if you want to run a script that contains PHP it must have an extension that is configured to be processed as PHP, normally .php, .php3 and .php3.

However, you can configure your web server to treat .html files as PHP, and you will then be able to include Magic Parser and use your code to parse the RSS feed and generate the HTML.

To do this, you need to add the following command to your Apache configuration file (something like /etc/httpd/conf/httpd.conf):

Addtype application/x-httpd-php .html

That will tell it to process .html files as PHP. You will have to restart your server for the changes to take effect.

Hope this helps!
Cheers,
David.

Submitted by waltonp on Tue, 2006-05-09 08:54

I thought it maybe something like that. The problem is I'm using a shared server and I guess my host won't restart the server for little ol' me. Is there a statement I could possibly use in .htaccess that achieves the same result?

Submitted by support on Tue, 2006-05-09 09:38

Hi,

I just checked, and it looks like AddType can go in .htaccess so it's worth a try...

http://httpd.apache.org/docs/1.3/mod/mod_mime.html#addtype

Submitted by waltonp on Tue, 2006-05-09 10:42

Thanks for your help. I'll give it a try. .htaccess is a bit of a black art!