Albert
Albert

Reputation: 157

Wordpress Subdirectory giving 404

I am trying to copy the root WP installation to a sub directory. (I changed the permalinks in the new copy database to the subdirectory links)

The subdirectory will be root/b2b/

When I try to reach the subdirectory I get redirected to a 404 page.

This is the .htaccess in the root

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

In the subdirectory I currently have no .htaccess since everything that I tried is not working.

I checked the other topics but none of them seems to work for me.

Upvotes: 3

Views: 8937

Answers (3)

John Reid
John Reid

Reputation: 1185

Add this to the root of your site.

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');

Has the added benefit of not needing to mess with the .htaccess if you're uncomfortable with that.

Upvotes: 0

dobriy_santa
dobriy_santa

Reputation: 76

You can change the RewriteBase

RewriteBase b2b

Upvotes: 1

Bhumi Shah
Bhumi Shah

Reputation: 9474

Replace following line

RewriteRule . /index.php [L]

to

RewriteRule . /b2b/index.php [L]

and

RewriteBase /

to

RewriteBase /b2b/

Upvotes: 6

Related Questions