auto_append_file给出错误(内部服务器错误)

时间:2012-03-31 06:34:50

标签: php .htaccess

我在.htaccess文件中追加两个文件并写下这些行:

php_value auto_append_file begin_caching.php
php_value auto_append_file end_caching.php

但它给了我内部服务器错误。

2 个答案:

答案 0 :(得分:1)

许多网站托管服务商禁止您在.htaccess中使用auto_prepend_file作为安全措施,因此这可能是您遇到500服务器错误的原因。

为什么不在PHP文件中使用它:

include 'begin_caching.php';

// Main PHP content

include 'end_caching.php';

答案 1 :(得分:0)

使用.htaccess文件的另一种方法是使用AddHandler

的.htaccess

AddHandler phptemplate .htm
AddHandler phptemplate .html
Action phptemplate /template.php

的template.php

<?php

if (!isset($_SERVER['ORIG_PATH_INFO']))
    die('Error.');

readfile(ltrim($_SERVER['ORIG_PATH_INFO'], '/'));

?>
相关问题