【发布时间】:2016-01-07 15:25:47
【问题描述】:
我有一个域 http://example.com 并安装了 wordpress。我也有一些子域,它们工作正常。 现在我想为我的域中不存在的任何 url 创建一个自定义 404 页面。例如:http://notexistingsubdomain.example.com。
如果我尝试这个,我会收到 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 设为我的域和子域中每个错误 URL 的自定义 404?
【问题讨论】:
标签: wordpress apache .htaccess http-status-code-404