Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Is there a way to just have php parsed in a single file rather than in all files ending in a particular extension?

For example, I know that

AddType application/x-httpd-php .html

will parse all .html files using the php parsing engine

But I want to only parse abc.html and not anythingelse.html I am thinking this is the directive

AddType application/x-httpd-php abc.html

but it does not work like I want it too.

Is what I am trying to do possible?

share|improve this question
up vote 1 down vote accepted

Just put your AddType directive inside a Files or FilesMatch container to only apply it to specific files.

share|improve this answer
That was exactly the answer. I tested it and it did just what I needed. Thanks joschi. – H. Ferrence Oct 2 '10 at 10:55

What about using mod_rewrite (.htaccess file) for the trick instead ?

RewriteEngine On
RewriteRule ^abc.html$ abc.php [L]

So when people go to they will actually be seeing abc.php, you can aswell hide abc.php somewhere else.

This is a internal redirection so only you would know where abc.php is.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.