How to find referrer URL while using htaccess 404 redirect?

前端 未结 1 452
甜味超标
甜味超标 2021-01-21 06:11

I\'ve used the code below to create a custom 404 message (page not found) using a .htaccess file.

RewriteEngine On
ErrorDocument 404 https://%{HTTP_HOST}/404.p         


        
相关标签:
1条回答
  • 2021-01-21 06:45

    Remove http:// from 404 handler and have it like this:

    ErrorDocument 404 /404.php
    

    The URL that is causing 404 is available to you in 404.php using:

    $_SERVER["REQUEST_URI"]
    

    When http:// ise used in 404 handler server performs full redirection and you loose original REQUEST_URI.

    0 讨论(0)
提交回复
热议问题