2015-10-09 75 views
0

我有一個域名http://example.com wordpress安裝。我也有一些子域名,他們工作正常。 現在我想爲我的域中不存在的任何url創建自定義404頁面。例如:http://notexistingsubdomain.example.com自定義404錯誤頁面錯誤的網址與wordpress安裝在根

如果我嘗試這個,我會得到500錯誤而不是404錯誤。

我的.htaccess看起來是這樣的:

ErrorDocument 404 /404.php 
RewriteRule ^subdir-name/.*$ - [PT] 
# BEGIN WordPress 
<IfModule mod_rewrite.c> 
RewriteEngine On 
RewriteBase/
RewriteRule ^index\.php$ - [L] 
RewriteCond %{REQUEST_FILENAME} !-f 
RewriteCond %{REQUEST_FILENAME} !-d 
RewriteRule . /index.php [L] 
</IfModule> 

# END WordPress 

我怎樣才能讓我的404.php自定義404對我的域和子域每一個錯誤的網址是什麼?

回答

0

Wordpress允許你在你的主題中使用404.php文件。 此文件用於所有「404錯誤」並顯示您的模板頁面。

這是更好的方式,使404.php

<?php get_header(); ?> 
<div>Some text here !</div> 
<?php get_footer(); ?> 

放入主題文件。然後定製它。

我希望能幫到你。

PS:不要忘了刪除.htacces文件自定義代碼。

+0

我結束了使用404從WordPress安裝,但每當我在unexisting子域類型,我還是得到一個500服務器錯誤。如何解決這個問題? –