Home > Software design >  404 path for php document
404 path for php document

Time:03-07

I created a .htaccess file with an ErrorDocument 404 that redirects me to a PHP page. My goal is to get the user's entered url, e.g.: User enters: https://test.de/example //not available He gets redirected to https://test.de/test.php and I need the old path /example

CodePudding user response:

Just add this to your .htaccess

ErrorDocument 404 /404.php

In this file you can retrieve the old path (/example) with

$_SERVER["REQUEST_URI"]
  • Related