Get Apache to send Content-Type text/plain for PHP

2

How do I get apache to send Content-Type text/plain for php files?

I can accomplish this in php using

header('Content-Type: text/plain');

I tried adding this to my vhost.conf (I am using Plesk) and reloading and restarting apache

<Directory />
    AddType text/plain php
</Directory>

It does not seem to help.

I also tried setting the AddType in .htaccess, but still no luck.

Peter Meth

Posted 2013-03-12T22:23:44.810

Reputation: 255

Answers

1

Your AddType is probably overriden somewhere else in your config. Use ForceType instead.

<FilesMatch "\.php$">
  ForceType text/plain
</FilesMatch>

Calimo

Posted 2013-03-12T22:23:44.810

Reputation: 1 119