2012-01-28 40 views

回答

3

在您的.htaccess文件中添加以下规则。

ErrorDocument 404 /error.php 

error.php文件中。

<?php // error.php 
echo $_SERVER["REQUEST_URI"]. " doesn't exists. Sorry!"; 
?> 
+0

Thanks! $ _SERVER [“REQUEST_URI”]正是我所期待的。 – nondefault 2012-01-31 02:35:59

0

只需通过添加在.htaccess以下规则添加下面的.htaccess文件(其中404.php是你的错误页)

ErrorDocument 404 /404.php 
0

你可以做到这一点。

ErrorDocument 404 /404.php 

在你的404.php,你可以写

<h3> 
Page Not Found. 
</h3> 
<div> 
    <p>Apologies, but the page you requested could not be found.</p> 
    <ul> 
     <li>You may have mistyped the page address.</li> 
     <li>You may have clicked on a link that has not been updated.</li> 
     <li>We have recently changed our site structure and the page has been moved to new location.</li> 
    </ul> 
</div> 

您可以风格使其正常显示。

希望这会有所帮助:)