Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/wordpress/13.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/.htaccess/6.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
在多个wordpress安装(子文件夹)上找不到404_Wordpress_.htaccess_Http Status Code 404 - Fatal编程技术网

在多个wordpress安装(子文件夹)上找不到404

在多个wordpress安装(子文件夹)上找不到404,wordpress,.htaccess,http-status-code-404,Wordpress,.htaccess,Http Status Code 404,在以下场景中,我需要如何设置.htaccess文件以正确发送404错误页面 www.example.com - main site have a WP installation www.example.com/folder-a/ - second WP installation www.example.com/folder-b/ - third WP installation 它们共享同一个数据库(不同的前缀) 我的问题是,我需要如何在每次安装时设置.htaccess以发送正确的404错误页面

在以下场景中,我需要如何设置.htaccess文件以正确发送404错误页面

www.example.com - main site have a WP installation
www.example.com/folder-a/ - second WP installation
www.example.com/folder-b/ - third WP installation
它们共享同一个数据库(不同的前缀)


我的问题是,我需要如何在每次安装时设置.htaccess以发送正确的404错误页面。

虽然404错误页面不会将访问者发送到他们想要的确切页面,但它确实为他们指明了正确的方向,这意味着他们更有可能留在您的网站上

一旦你有了404页面设置,你需要做的就是将访问者发送到这个页面的错误url。为此,只需在.htaccess文件中添加以下行:

ErrorDocument 404 /404.php
你可以把404错误模板放在任何你想要的地方。例如,您可以将所有错误消息放在名为errormessages的文件夹中

    ErrorDocument 404 /errormessages/404.php 
您可以在每次安装时对每个.htaccess执行此操作