У меня ошибка на сервере: 500 Internal Server Error - PullRequest
0 голосов
/ 22 мая 2019

Я переместил код с одного сервера на другой. На сайте я скачиваю для авторизованных пользователей. Когда я ввожу файл, который проверяет, вошел ли я в систему или нет, он показывает ошибку 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;
}

?>
...