Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ErrorDocument 403 /index.php/RESERVED.HTTP-STATUS-403.html
- ErrorDocument 404 /index.php/RESERVED.HTTP-STATUS-404.html
- error_page 404 /RESERVED.HTTP-STATUS-404.html;
- error_page 403 /RESERVED.HTTP-STATUS-403.html;
- location ~ ^/RESERVED.HTTP-STATUS-(403|404).html$ {
- rewrite ^/RESERVED.HTTP-STATUS-(403|404).html$ /index.php$0 last;
- }
- /*Verifica se a função não esta disponível (versões anteriores ao php5.4)*/
- if (false === function_exists('http_response_code')) {
- /*Fallback para versões mais antigas que o PHP5.4*/
- function http_response_code($code = null)
- {
- static $currentStatus;
- if ($code === null) {
- if ($currentStatus !== null) {
- return $currentStatus;
- }
- $currentStatus = 200;
- if (empty($_SERVER['PHP_SELF']) === false &&
- preg_match('#/RESERVED.HTTP-STATUS-(d{3}).html$#', $_SERVER['PHP_SELF'], $match) > 0)
- {
- $currentStatus = (int) $match[1];
- }
- } elseif (is_int($code) && headers_sent() === false) {
- header('X-PHP-Response-Code: ' . $code, true, $code);
- $currentStatus = $code;
- }
- return $currentStatus;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement