我在服务器上有一个错误:500 Internal Server Error

时间:2019-05-22 17:42:49

标签: php html .htaccess internal-server-error

我将代码从一台服务器移到了另一台服务器。在网站上,我正在为登录用户下载。当我输入检查是否已登录的文件时,它显示错误500(内部服务器错误)。下面我给出代码.htaccess和download.php

.htaccess:

Options -Indexes 

<files .htaccess> 
order allow,deny deny from all 
</files> 

<FilesMatch "\.(htaccess|htpasswd|ini|phps|fla|psd|log|sh|pdf|mp4)$"> 
Order Allow,Deny Deny from all 
</FilesMatch>

RewriteEngine on
RewriteRule ^(.*).pdf$ http://example.com [R=301,L]

Download.php:

<?php ob_start();?>
<?php session_start();?>

<?php
if (!isset($_SESSION['login_user'])) {
    header("location: http://example.com");
    exit;
}
if ($_SESSION['nazwau'] == "ALG2") {
        $file = './pdf/test.pdf';


header('Content-Description: File Transfer');
header('Content-Type: application/octet-stream');
header('Content-Disposition: attachment; filename=' .                                 basename($file));
header('Content-Transfer-Encoding: binary');
header('Expires: 0');
header('Cache-Control: must-revalidate, post-check=0, pre-check=0');
header('Pragma: public');
header('Content-Length: ' . filesize($file));
ob_clean();
flush();
readfile($file);
exit;
} else {
    header("location: http://example.com/");
    exit;
}

?>

0 个答案:

没有答案