Wordpress子目录给出404



我正在尝试将根WP安装复制到一个子目录中。(我将新副本数据库中的永久链接更改为子目录链接)

子目录将是root/b2b/

当我尝试访问子目录时,我会被重定向到404页面。

这是根中的.htaccess

# 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>

在子目录中,我目前没有.htaccess,因为我尝试的所有操作都不起作用。

我检查了其他主题,但似乎没有一个对我有效。

替换以下行

RewriteRule . /index.php [L]

RewriteRule . /b2b/index.php [L]

RewriteBase /

RewriteBase /b2b/

您可以更改RewriteBase

RewriteBase b2b

将其添加到站点的根目录中。

index.php:

<?php
/**
 * Front to the WordPress application. This file doesn't do anything, but loads
 * wp-blog-header.php which does and tells WordPress to load the theme.
 *
 * @package WordPress
 */
/**
 * Tells WordPress to load the WordPress theme and output it.
 *
 * @var bool
 */
define('WP_USE_THEMES', true);
/** Loads the WordPress Environment and Template */
require('./b2b/wp-blog-header.php');

如果你对.htaccess感到不舒服的话,它还有一个额外的好处,那就是不需要麻烦它。

最新更新