views:

146

answers:

3

I want to be able to name my files with whatever extension I choose. In this case let’s use .foo, and then process them as PHP files.

Right now my .htaccess looks like this

AddType application/x-httpd-php .foo

But it doesn’t work, it still prompts me to download the file when I access it.

Any advice or tips?

+3  A: 

Try:

rewriteengine on
rewriterule ^(.*)\.foo$ $1.php
Andrew G. Johnson
no success, should i have anything else in the htaccess file?
Patrick
Yes, you'll need `RewriteEngine on` before this..
ceejayoz
Ya sorry you need rewriteengine on (if you are using other rewriterules it will probably already be set)
Andrew G. Johnson
+2  A: 

AddType application/x-httpd-php .html

The syntax looks right to me .. Did you try rebooting the web server?

Also, are there any other settings in .htaccess file working? I mean just make sure that this file is being parsed.

Wbdvlpr
A: 

You could use mod_rewrite to rewrite the requests of *.foo to *.php:

RewriteEngine on
RewriteRule (.+)\.php$ $1.php

This rule will rewrite any request that’s URL path ends on .foo internally to the equivalent .php URL path.

Gumbo
Essentially my answer with a typo :) Actually I forgot the slash...
Andrew G. Johnson