9

This is what Apache needs. I like to know how I do this in h2o.

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]

// wasted 300 reputation on this btw.

redanimalwar
  • 1,229
  • 1
  • 12
  • 32

1 Answers1

-1

Basically, your Apache file is a bit too much for WordPress.

This should do the trick on H2O:

hosts:
  "www.example.com":
    listen:
      port: 80
    paths:
      "/":
        file.dir: /path/to/doc-root   # serve static files if found
        redirect:                     # if not found, internally redirect to /index.php/<path>
          url: /index.php/
          internal: YES
          status: 307

file.custom-handler:                  # handle PHP scripts using php-cgi (FastCGI mode)
  extension: .php
  fastcgi.spawn: "PHP_FCGI_CHILDREN=10 exec /usr/bin/php-cgi"

access-log: /path/to/the/access-log
error-log: /path/to/the/error-log
pid-file: /path/to/the/pid-file
http2-reprioritize-blocking-assets: ON   # performance tuning option

Hope this helps...

Zvonko Biskup
  • 393
  • 2
  • 9
  • I think you totally failed to understand my question. I did not ask about a very basic server config. I specifically asked about *rewrite rules*. How is this helping? Also as a sidenote, I do not know why the h2o wiki shows a PHP-CGI config as a WordPress config. I use a different config to use PHP-FPM. To me it makes no sense to use a high performance server to then use a slower PHP solution. AFAIK PHP-FPM ist faster. – redanimalwar Oct 04 '17 at 13:52
  • "Basically, your Apache file is a bit too much for WordPress." seriously if you have no clue what you are talking about then don't answer questions. I asked for **mruby code**. Either way WordPress never interprets server config files so your "to much for WP" notion is total BS! I really have a hard time trying to understand how you can give such a crappy answer. You think I put the .htaccess code into me h2o.conf? And you think the multisite rewriting just simply works like magic without any config?I did not try to switch to FastCGI (use your config) because I am pretty sure there is no point – redanimalwar Oct 04 '17 at 14:10