Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

Now that WordPress 3.5 is supposed to work with core files in subdirectory, I decided to move my local development setup (subdirectory multisite) to that configuration.

Fast forward and what I have is following:

wordpress (3.5 core)

wp-content (content dir, configured via WP_CONTENT_DIR and WP_CONTENT_URL)

.htaccess with:

RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ - [L]

# uploaded files
RewriteRule ^([_0-9a-zA-Z-]+/)?files/(.+) C:\server\www\dev\wordpress/wp-includes/ms-files.php?file=$2 [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).*) C:\server\www\dev\wordpress/$2 [L]
RewriteRule ^([_0-9a-zA-Z-]+/)?(.*\.php)$ C:\server\www\dev\wordpress/$2 [L]
RewriteRule . index.php [L]

wp-config.php with:

define('MULTISITE', true);
define('SUBDOMAIN_INSTALL', false);
define('DOMAIN_CURRENT_SITE', 'dev.rarst.net');
define('PATH_CURRENT_SITE', '/');
define('SITE_ID_CURRENT_SITE', 1);
define('BLOG_ID_CURRENT_SITE', 1);

index.php with:

define('WP_USE_THEMES', true);
require('./wordpress/wp-blog-header.php');

Status:

  • network admin works at /wordpress/wp-admin/network/ but all links try to point to /wp-admin/network/ which errors Forbidden with The given path was above the root path: AH00127: Cannot map GET /wp-admin/network/ HTTP/1.1 to file
  • root site works at dev.rarst.net with admin at dev.rarst.net/wordpress/wp-admin
  • other subdir sites (dev.rarst.net/*) have broken uploads, and links to admin and stuff, hadn't got to them yet.

The question in a nutshell - in what direction do I need to move from here to get everything working?

What admin links are even supposed to be with this setup (since core is in "real" subdir and sites are in "virtual" subdirs)?

share|improve this question
    
Possible Duplicate: wordpress.stackexchange.com/q/76913/19726 –  bungeshea Jan 3 '13 at 21:02

1 Answer 1

up vote 4 down vote accepted

Your .htaccess lines need to look like this:

RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ - [L]

# uploaded files
RewriteRule ^([_0-9a-zA-Z-]+/)?files/(.+) /wordpress/wp-includes/ms-files.php?file=$2 [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).*) /wordpress/$2 [L]
RewriteRule ^([_0-9a-zA-Z-]+/)?(.*\.php)$ /wordpress/$2 [L]
RewriteRule . index.php [L]

.htaccess can't access locations outside of the document root, that is why paths like C:\server\www\dev\ fail. (The code above has been tested on my localhost multisite install).

Because of the .htaccess rewrite, you don't need to set WP_CONFIG_DIR and WP_CONFIG_URL they are calculated by WordPress accordingly. You can access your admin pages at http://dev.rarst.net/wp-admin or http://dev.rarst.net/subsite/wp-admin

share|improve this answer
    
Yep, removing absolute part of path seems to fix it so it's a problem with network admin spitting out wrong rules. There is open trac ticket Wrong RewriteRule in a local Multisite installation on it. –  Rarst Jan 3 '13 at 21:08

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.