2013-04-28 71 views
0

的文件重定向到這個文件,其中包含:PHP的重定向是搞砸

<? 
if(!session_id()) { 
session_start(); 
if (strlen($_SESSION['login']) < 1) 
die("you're not logged in!"); 
} 
$changer = $_POST['form1']; 
switch($changer) { 
case 'write': 
header("Location: http://teachertechtutor.com/php/learn/kinder/write.php"); 
break; 

case 'read': 
header("Location: http://teachertechtutor.com/php/learn/kinder/read.php"); 
break; 

case 'math': 
header("Location: http://teachertechtutor.com/php/learn/kinder/math.php"); 
break; 
} 
?> 

但是當這一個重定向它增加了一個奇怪的事情像數學之一: http://teachertechtutor.com/redirects/kinder.php?math=Math%21

爲什麼不把它添加整個重定向的東西......? 重定向/ kinder.php?數學=數學21%應該是PHP /學習/親切/ math.php

+2

此腳本不會向網址添加「%21」。檢查你是否有mod_rewrite或者與url相關的東西,這完全是出於php的控制。 – 2013-04-28 02:19:15

回答

0
%21 

代表HTML中的感嘆號。 URL Encoding Functions

由於這是重定向到kinder.php文件,這很可能導致.htaccess文件導致所有URLS重定向到kinder.php文件的問題。

看看您的.htaccess文件中是否有任何包含「kinder.php」的代碼來查找問題。至於調整它,如果你能夠發佈.htaccess代碼,我會非常樂意協助。