我目前有两个网站(主网站和子网站)与多网站功能创建。最近,我注意到404错误页面在主站点上似乎不起作用。无论我键入什么错误url来测试错误页,它都会将我带到主页,而不是404页。但是,它可以很好地处理子站点。我不知道如何解决这个问题。
以下是我的目录中的htaccess文件:
# BEGIN WordPress
RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
# END WordPress
在上述代码之前,代码显示如下(由主机提供程序添加:
RewriteEngine On
RewriteBase /
RewriteRule ^index\\.php$ - [L]
# add a trailing slash to /wp-admin
RewriteRule ^([_0-9a-zA-Z-]+/)?wp-admin$ $1wp-admin/ [R=301,L]
RewriteCond %{REQUEST_FILENAME} -f [OR]
RewriteCond %{REQUEST_FILENAME} -d
RewriteRule ^ - [L]
RewriteRule ^([_0-9a-zA-Z-]+/)?(wp-(content|admin|includes).*) $2 [L]
RewriteRule ^([_0-9a-zA-Z-]+/)?(.*\\.php)$ $2 [L]
RewriteRule . index.php [L]
#RewriteEngine on
#RewriteCond %{HTTP_HOST} ^ncc.my$
#RewriteCond %{REQUEST_URI} !^.*www.*$
#RewriteRule ^(.*)$ http://www.ncc.my [R=301]
根据上面的htaccess文件,它应该可以正常工作。有什么解决办法吗?请谢谢
Updated:
<?php
define( \'NOBLOGREDIRECT\', \'http://www.ncc.my\' );
/**
* WordPress Database Table prefix.
*
* You can have multiple installations in one database if you give each a unique
* prefix. Only numbers, letters, and underscores please!
*/
$table_prefix = \'wp_\';
/**
* For developers: WordPress debugging mode.
*
* Change this to true to enable the display of notices during development.
* It is strongly recommended that plugin and theme developers use WP_DEBUG
* in their development environments.
*/
define(\'WP_DEBUG\', false);
/* Multisite */
define( \'WP_ALLOW_MULTISITE\', true );
define(\'MULTISITE\', true);
define(\'SUBDOMAIN_INSTALL\', true);
define(\'DOMAIN_CURRENT_SITE\', \'www.ncc.my\');
define(\'PATH_CURRENT_SITE\', \'/\');
define(\'SITE_ID_CURRENT_SITE\', 1);
define(\'BLOG_ID_CURRENT_SITE\', 1);
/* That\'s all, stop editing! Happy blogging. */
/** Absolute path to the WordPress directory. */
if ( !defined(\'ABSPATH\') )
define(\'ABSPATH\', dirname(__FILE__) . \'/\');
/** Sets up WordPress vars and included files. */
require_once(ABSPATH . \'wp-settings.php\');