开发者

Add one or two files to be parsed by PHP in htaccess

I'd like to change one text file on my server to be parsed by PHP -开发者_JAVA百科 how do I do this?


I assume you already have the appropriate lines in Apache to enable PHP in general. To use PHP to parse a non .php ending file, you can use a ForceType directive in either an htaccess file or in the apache config. For example:

<Files ~ '^(file1.txt|anotherfile.txt)$'>
        ForceType application/x-httpd-php
</Files>

That expression is flexible and you can add additional files to match within the parentheses using another pipe character.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜