我不明白。我在.htaccess
設置的404錯誤,它會被重定向到error.php
當我鍵入類似http://{localhost}/mywebiste/xxx/xxx/xxx/xxx/
404錯誤 - 未定義索引:REDIRECT_URL
,但我得到這個錯誤,
Notice: Undefined index: REDIRECT_URL in C:\...
Notice: Undefined index: REDIRECT_STATUS in C:\...
的,
$_SERVER["REDIRECT_URL"];
$_SERVER['REDIRECT_STATUS'];
的.htaccess,
RewriteEngine on
ErrorDocument 404 http://{localhost}/projects/.../error.php
error.php,
$redirect_url = $_SERVER["REDIRECT_URL"];
$status = $_SERVER['REDIRECT_STATUS'];
任何想法?
我已嘗試這兩個網站的代碼和他們沒有工作,
而且,我在的EasyPHP Devsever。我要檢查是否有
print_r($_SERVER);
我得到這個,
Array
(
[TMP] => C:/Program Files (x86)/EasyPHP-DevServer-14.1VC11/binaries/tmp
[HTTP_HOST] => localhost
[HTTP_USER_AGENT] => Mozilla/5.0 (Windows NT 6.1; WOW64; rv:33.0) Gecko/20100101 Firefox/33.0
[HTTP_ACCEPT] => text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
[HTTP_ACCEPT_LANGUAGE] => en-GB,en;q=0.5
[HTTP_ACCEPT_ENCODING] => gzip, deflate
[HTTP_COOKIE] => PHPSESSID=204j1jvbinr4j1i0ebg9eq0ue5
[HTTP_CONNECTION] => keep-alive
[PATH] => C:\Program Files (x86)\EasyPHP-DevServer-14.1VC11\binaries\php\php_runningversion;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0\;C:\Program Files\WIDCOMM\Bluetooth Software\;C:\Program Files\WIDCOMM\Bluetooth Software\syswow64;\;C:\Program Files (x86)\Sony\VAIO Startup Setting Tool;C:\Program Files (x86)\Common Files\Roxio Shared\10.0\DLLShared\;C:\Program Files (x86)\Common Files\Roxio Shared\DLLShared\;C:\Program Files (x86)\QuickTime\QTSystem\;C:\Program Files\Java\jdk1.8.0_05\bin;C:\Program Files\nodejs\;C:\Program Files (x86)\Git\cmd;C:\Users\lau_thiamkok\AppData\Roaming\npm;C:\Program Files\nodejs;C:\Program Files (x86)\Git;C:\PROGRA~2\EASYPH~1.1VC\Apache\bin;C:\PROGRA~2\EASYPH~1.1VC\PHP
[SystemRoot] => C:\Windows
[COMSPEC] => C:\Windows\system32\cmd.exe
[PATHEXT] => .COM;.EXE;.BAT;.CMD;.VBS;.VBE;.JS;.JSE;.WSF;.WSH;.MSC
[WINDIR] => C:\Windows
[SERVER_SIGNATURE] =>
[SERVER_SOFTWARE] => Apache/2.4.7 (Win32) PHP/5.5.8
[SERVER_NAME] => localhost
[SERVER_ADDR] => 127.0.0.1
[SERVER_PORT] => 80
[REMOTE_ADDR] => 127.0.0.1
[DOCUMENT_ROOT] => C:/Program Files (x86)/EasyPHP-DevServer-14.1VC11/data/localweb
[REQUEST_SCHEME] => http
[CONTEXT_PREFIX] =>
[CONTEXT_DOCUMENT_ROOT] => C:/Program Files (x86)/EasyPHP-DevServer-14.1VC11/data/localweb
[SERVER_ADMIN] => [email protected]
[SCRIPT_FILENAME] => C:/Program Files (x86)/EasyPHP-DevServer-14.1VC11/data/localweb/projects/tests/php-boilerplate/404/basic/error.php
[REMOTE_PORT] => 55762
[GATEWAY_INTERFACE] => CGI/1.1
[SERVER_PROTOCOL] => HTTP/1.1
[REQUEST_METHOD] => GET
[QUERY_STRING] => code=404
[REQUEST_URI] => /projects/tests/php-boilerplate/404/basic/error.php?code=404
[SCRIPT_NAME] => /projects/tests/php-boilerplate/404/basic/error.php
[PHP_SELF] => /projects/tests/php-boilerplate/404/basic/error.php
[REQUEST_TIME_FLOAT] => 1416567060.231
[REQUEST_TIME] => 1416567060
)
,但我沒有看到REDIRECT_*
爲the list here。
任何想法如何我可以得到REDIRECT_*
在我的本地主機工作?
如果我不這麼做。那麼它不能被重定向。 – laukok 2014-11-21 08:46:13