Search code examples
phpapache.htaccessfile-type

how to use htaccess to disguise filetypes


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?


Solution

  • Try:

    rewriteengine on
    rewriterule ^(.*)\.foo$ $1.php