Please note the new address for this forum : forum.excito.org. The old address redirects here but I don't know for how long. Thanks !
New user's registration have been closed due to high spamming and low trafic on this forum. Please contact forum admins directly if you need an account. Thanks !

WordPress multisites

Got problems with your B2 or B3? Share and get helped!
Binkem
Posts: 388
Joined: 10 Jul 2008, 02:26

WordPress multisites

Post 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
Cheeseboy
Posts: 789
Joined: 08 Apr 2007, 12:16

Re: WordPress multisites

Post 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
Binkem
Posts: 388
Joined: 10 Jul 2008, 02:26

Re: WordPress multisites

Post 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.
Eek
Posts: 372
Joined: 23 Dec 2007, 03:03
Location: the Netherlands

Re: WordPress multisites

Post 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
cheers
Eek
Binkem
Posts: 388
Joined: 10 Jul 2008, 02:26

Re: WordPress multisites

Post 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
Eek
Posts: 372
Joined: 23 Dec 2007, 03:03
Location: the Netherlands

Re: WordPress multisites

Post 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
cheers
Eek
Ubi
Posts: 1549
Joined: 17 Jul 2007, 09:01

Re: WordPress multisites

Post 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
Binkem
Posts: 388
Joined: 10 Jul 2008, 02:26

Re: WordPress multisites

Post 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?
Ubi
Posts: 1549
Joined: 17 Jul 2007, 09:01

Re: WordPress multisites

Post by Ubi »

there's a Redirect *somewhere* in any of the config files I guess. Try grepping for them.
Binkem
Posts: 388
Joined: 10 Jul 2008, 02:26

Re: WordPress multisites

Post 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.
Ubi
Posts: 1549
Joined: 17 Jul 2007, 09:01

Re: WordPress multisites

Post 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
Binkem
Posts: 388
Joined: 10 Jul 2008, 02:26

Re: WordPress multisites

Post 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).
Eek
Posts: 372
Joined: 23 Dec 2007, 03:03
Location: the Netherlands

Re: WordPress multisites

Post by Eek »

that is because of the /home/web/index.html

In it is a redirect defined to /admin
cheers
Eek
Binkem
Posts: 388
Joined: 10 Jul 2008, 02:26

Re: WordPress multisites

Post by Binkem »

I deleted index.html way back.
Ubi
Posts: 1549
Joined: 17 Jul 2007, 09:01

Re: WordPress multisites

Post by Ubi »

would enabling the rewritelog help?
Post Reply