Wordpress子目录给404

时间:2014-11-10 11:30:18

标签: php wordpress apache .htaccess

我正在尝试将复制根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,因为我尝试的所有内容都不起作用。

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

3 个答案:

答案 0 :(得分:3)

替换以下行

RewriteRule . /index.php [L]

RewriteRule . /b2b/index.php [L]

RewriteBase /

RewriteBase /b2b/

答案 1 :(得分:0)

您可以更改RewriteBase

RewriteBase b2b

答案 2 :(得分:0)

将此添加到您网站的根目录。

的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。

相关问题