Forum

Wordpress multisite

Fred
3 March 2015, 13:01
Hello,

I have a domain that I would like to move from my old Nginx server to my new Hiawatha server.
The problem is that the site is build in Wordpress multisite. In order for it to work correctly in Nginx I had to set specific Nginx rewrite rules...

Could anyone tell me if the same apply in Hiawatha webserver?
If yes, could you please share the config file?

Thank you in advance

Hiawatha version: v9.8
Operating System: FreeBSD 10
Hugo Leisink
3 March 2015, 13:04
Rewrite rules for Wordpress are already available. If those are not the ones you are looking for, post the Nginx rules here and perhaps I can convert them for you. Nginx rules don't work directly for Hiawatha.
Fred
4 March 2015, 23:27
Hi Hugo,

This is the rules I use at the moment in Nginx
# WordPress multisite subdirectory rules.
# Designed to be included in any server {} block.
index index.php;
# This order might seem weird - this is attempted to match last if rules below fail.
# http://wiki.nginx.org/HttpCoreModule
location / {
try_files $uri $uri/ /index.php?$args;
}
# Add trailing slash to */wp-admin requests.
rewrite /wp-admin$ $scheme://$host$uri/ permanent;
# Pass all .php files onto a php-fpm/php-fcgi server.
location ~ \.php$ {
# Zero-day exploit defense.
# http://forum.nginx.org/read.php?2,88845,page=3
# Won't work properly (404 error) if the file is not stored on this server, which is entirely possible with php-fpm/php-fcgi.
# Comment the 'try_files' line out if you set up php-fpm/php-fcgi on another machine. And then cross your fingers that you won't get hacked.
try_files $uri =404;
# fastcgi_split_path_info ^(.+\.php)(/.+)$;
#NOTE: You should have "cgi.fix_pathinfo = 0;" in php.ini
include fastcgi_params;
fastcgi_index index.php;
# fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
# fastcgi_intercept_errors on;
fastcgi_pass php5-fpm;
}
location ~ ^/files/(.*)$ {
try_files /wp-content/blogs.dir/$blogid/$uri /wp-includes/ms-files.php?file=$1 ;
# access_log on; log_not_found on; expires max;
}
#avoid php readfile()
location ^~ /blogs.dir {
internal;
alias /var/www/wordpress/wp-content/blogs.dir ;
access_log off; log_not_found off; expires max;
}
# Directives to send expires headers and turn off 404 error logging.
location ~* ^.+\.(xml|ogg|ogv|svg|svgz|eot|otf|woff|mp4|ttf|css|rss|atom|js|jpg|jpeg|gif|png|ico|zip|tgz|gz|rar|bz2|doc|xls|exe|ppt|tar|mid|midi|wav|bmp|rtf)$ {
access_log off; log_not_found off; expires max;
}


Thank you
Fred
Fred
4 March 2015, 23:42
I don't know if this is easier for you to translate but using .htacess, the rules are:
RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ - [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]
Hugo Leisink
5 March 2015, 09:07
It should be something like this:
UrlToolkit {
ToolkitID = multiwp
Match ^/index\.php$ Return
Match ^/([_0-9a-zA-Z-]+/)?wp-admin$ Redirect /$1wp-admin/
RequestURI exists Return
Match ^/([_0-9a-zA-Z-]+/)?(wp-(content|admin|includes).*) Rewrite /$2
Match ^/([_0-9a-zA-Z-]+/)?(.*\.php)$ Rewrite /$2
Match .* Rewrite /index.php
}

I haven't tested this rule, so it's very well possible it needs some tweaking.
Fred
6 March 2015, 15:57
Thank you very much Hugo.
I'll load them into my config file and let you know
Fred
6 March 2015, 17:25
Hi Hugo,

The system is complaining of syntax error.
But I have no info about it, and the log isn't giving me anything.
Any chance you could assist me a little bit further please?

Thank you
Fred
Hugo Leisink
6 March 2015, 18:11
Syntax error in what line?
Fred
6 March 2015, 21:46
It state line 144 wich correspond to the
UrlToolkit {


I haven't got more information sorry
Hugo Leisink
6 March 2015, 22:06
Are you sure it only says "UrlToolkit {"? Please, check carefully.
Fred
7 March 2015, 00:13
This is the only error that I can find
root@zion /# service hiawatha start
Starting hiawatha.
Syntax error in hiawatha.conf on line 144.
/usr/local/etc/rc.d/hiawatha: WARNING: failed to start hiawatha

This is the line it refered to
136
137 UrlToolkit {
138 ToolkitID = wordpress
139 RequestURI exists Return
140 Match .*\?(.*) Rewrite /index.php?$1
141 Match .* Rewrite /index.php
142 }
143
144 UrlToolit {
145 ToolkitID = multiwp
146 Match ^/index\.php$ Return
147 Match ^/([_0-9a-zA-Z-]+/)?wp-admin$ Redirect /$1wp-admin/
148 RequestURI exists Return
149 Match ^/([_0-9a-zA-Z-]+/)?(wp-(content|admin|includes).*) Rewrite /$2
150 Match ^/([_0-9a-zA-Z-]+/)?(.*\.php)$ Rewrite /$2
151 Match .* Rewrite /index.php
152 }
153

The system.log file has no information.

Fred
Hugo Leisink
7 March 2015, 01:39
UrlToolit should be UrlToolkit
fred
7 March 2015, 20:30
Oops,

Now I feel embarrassed
Thank you very much for the support.

Fred
This topic has been closed.