开发者

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

开发者 https://www.devze.com 2023-01-23 15:15 出处:网络
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 p

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

精彩评论

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