Page 1 of 2

WordPress multisites

Posted: 09 Aug 2011, 04:37
by Binkem
Hi,

I'm trying to run two web-sites from a singe WordPress install. (www.mysite.nl and www.mysite.nl/subsite)
This requires a .htaccess file in the /home/web directory:

Code: Select all

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

# uploaded files
RewriteRule ^([_0-9a-zA-Z-]+/)?files/(.+) 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).*) $2 [L]
RewriteRule  ^[_0-9a-zA-Z-]+/(.*\.php)$ $2 [L]
RewriteRule . index.php [L]
It seems, however that Apache doesn't follow these rewrite rules. I added the lines

Code: Select all

<Directory />
AllowOverride All
</Directory>
before the above lines, but this doesn't help. I'm afraid this is because of the settings in sites-enabled.

Does anyone know how to get this working?

Martijn

Re: WordPress multisites

Posted: 09 Aug 2011, 06:07
by Cheeseboy
Hi Martijn,
I added the lines

<Directory />
AllowOverride All
</Directory>
Where exactly did you add this?

I think you have to do it in either /etc/apache2/httpd.conf or in one of the sites-enabled files.
It was a long time ago, but I found I have added this in my Bubba2 /etc/apache2/httpd.conf file at some time:

Code: Select all

<Directory /home/web/roundcubemail-0.4-beta >
        AllowOverride All
</Directory>
Hope this might help, even though it is a bit vague...

Cheers,

Niklas

Re: WordPress multisites

Posted: 09 Aug 2011, 06:33
by Binkem
I added the lines to the .htaccess file in the /home/web directory.
I tried adding them to httpd.conf too, but this didn't help.

Re: WordPress multisites

Posted: 09 Aug 2011, 14:47
by Eek
I am not sure what it is that is not working or what you want or expect.
But you can add some logging to see if the rewrites are working for you
add the following to lines

Code: Select all

RewriteLog "/var/log/apache2/rewrite.log"
RewriteLogLevel 4

Re: WordPress multisites

Posted: 09 Aug 2011, 17:01
by Binkem
The .htaccess fil I created in the /home/web directory doesn't log anything.
If I try to log the httpd.conf file I get rewrite logs for Bubba's admin pages, but nothing for my wordpress sites. Should I enable this /htaccess file somewhere? or should I move the Wordpress rewrite rules to another file?

Edit:
I seem to have gotten the rewite to work by editing sites-enabled/bubba by changing allow_override to all
Please advice me if this is safe for the rest of my b3

Re: WordPress multisites

Posted: 10 Aug 2011, 00:29
by Eek
Yes that is safe.
All allow_override does is allow to override the settings in apache config by for example a .htaccess file :D

Re: WordPress multisites

Posted: 10 Aug 2011, 13:50
by Ubi
turning on allow_override is only a problem for ISPs that let unknown third parties upload arbitrary apache rules. In your case, it doesn't really have any influence

Re: WordPress multisites

Posted: 02 Oct 2011, 16:40
by Binkem
Next question:

I've finally got the multisite to work properly. Now the next problem is that if I want to access the dashboard (a symlink from /www.mysite.nl/secondsitename/wp-admin to somewhere else within WordPress) my bubba refers back to www.mysite.nl/admin, thus to the Bubba's admin page. Any ideas?

Re: WordPress multisites

Posted: 02 Oct 2011, 17:17
by Ubi
there's a Redirect *somewhere* in any of the config files I guess. Try grepping for them.

Re: WordPress multisites

Posted: 03 Oct 2011, 16:36
by Binkem
I found this conf file:

/etc/apache2/conf.d/admin.conf

Where I found the following lines:
<Location /admin>
RewriteEngine on
RewriteBase /admin
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php?/$1 [L]
</Location>
It might be the case that this causes the pages called * wp-admin* get redirected to bubba/admin. Problem is that I don't know how this works or how I can tell the redirect to ignore pages called wp-admin.

Re: WordPress multisites

Posted: 04 Oct 2011, 13:27
by Ubi
this is not it, as this rewrite is only valid if you are already within location /admin. Your problem seems to be that you get moved into /admin against your will right?

But, if you want to be sure this is the culprit, comment out the <location> section and see if it solves the problem

Re: WordPress multisites

Posted: 04 Oct 2011, 15:00
by Binkem
Hi Ubi,

You're absolutely right!
I found another strange thing: if i type
My bubba takes me to the right page. If I don't type index.php it redirects to www.mysite.nl/admin (the bubba admin page).

Re: WordPress multisites

Posted: 05 Oct 2011, 01:58
by Eek
that is because of the /home/web/index.html

In it is a redirect defined to /admin

Re: WordPress multisites

Posted: 05 Oct 2011, 15:50
by Binkem
I deleted index.html way back.

Re: WordPress multisites

Posted: 05 Oct 2011, 16:20
by Ubi
would enabling the rewritelog help?