Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I am using apache2 and mod-proxy to integrate wordpress blogs into subdirectories of my TLD.

  • Main site:
  • Blog1: []
  • Blog2: []

Apach2 virtual host of the main site with proxy:

<VirtualHost *:80>


# Rewrite rule to add missing slashes
RewriteRule ^/blog$ /blog/ [R=301]
RewriteRule ^/other-blog$ /other-blog/ [R=301]

<Proxy *>
Order deny,allow
Allow from all

ProxyRequests off
ProxyPass /blog/ http://blog1.localhost/
ProxyPassReverse /blog/ http://blog1.localhost/
ProxyPass /other-blog/ http://blog2.localhost/
ProxyPassReverse /other-blog/ http://blog2.localhost/



Apach2 virtual hosts for blogs:

<VirtualHost *:80>
ServerName blog1.localhost
DocumentRoot /var/www/blog1/
<Directory />
Options FollowSymLinks
AllowOverride All

Linux hosts file add lines:     blog1.localhost localhost.localdomain     blog2.localhost localhost.localdomain

Wordpress: Settings > General Settings:

  • WordPress address (URL): []
  • Site address (URL): []

The .htaccess file:

<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]

This setup works fine in general. Unfortunately the back end of Wordpress has problems at some parts by stripping the sub-folders in URLs resulting in problems of saving settings or loading pictures. eg.:

  • Uses: []
  • Should use: []


  • Uses: []
  • Should use: []

What I tried so far:

Nothing of it worked so far or made it worse.

If somebody has an idea of how to solve this problem I would very much appreciate this.

*) Edit: What I already tried here:

define('WP_HOME',  'http://' . $_SERVER['HTTP_HOST'] . '/blog');
define('WP_HOME', '');
define('WP_SITEURL', '' . $_SERVER['SERVER_NAME'] . '/blog');
define('WP_SITEURL', 'http://' . $_SERVER['SERVER_NAME'] . '/blog');
define('WP_SITEURL', '');
share|improve this question
Did you get this issue resolved? If so, can you add the solution? – Pre101 Jul 5 '12 at 21:54

The absolute (and wrong) paths are in the content generated by WordPress - there's no way to rewrite them with Apache (how would Apache know which blog is meant when a client asks for /wp-content?).

Modifying the site URL in the WordPress config is the correct path.

For the blog1 instance:

define('WP_SITEURL', '');

For the blog2 instance:

define('WP_SITEURL', '');

What have you tried, and what behavior did you see?

share|improve this answer
Ty, I added the line to my wp-config.php unfortunately it does not make a difference at all. Eg. at the add picture tool for articles or when I try to delete a plugin the sub-folder gets still lost and I land at the 404 page of my main site. Any other suggestions? – Oskar Oct 11 '11 at 3:37

You may need to move your wordpress installations to a subdirectory to solve this issue. Once done that, edit the your rewrite rules to something similar to this:

<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /blog1/
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /blog1/index.php [L]
share|improve this answer

Your Answer


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.