Skip to content

Instantly share code, notes, and snippets.

@wokamoto
Created July 1, 2014 01:55
Show Gist options
  • Save wokamoto/5b2097e5790ebbc1a4e4 to your computer and use it in GitHub Desktop.
Save wokamoto/5b2097e5790ebbc1a4e4 to your computer and use it in GitHub Desktop.
[WordPress] bogo ver.2.2 nginx rearite 対応パッチ
--- includes/rewrite.php.org 2014-07-01 10:51:03.000000000 +0900
+++ includes/rewrite.php 2014-07-01 10:51:50.000000000 +0900
@@ -38,7 +38,7 @@
$permastruct = $wp_rewrite->permalink_structure;
- if ( ! apache_mod_loaded( 'mod_rewrite', true ) && ! iis7_supports_permalinks() )
+ if ( ! got_url_rewrite() )
$permastruct = preg_replace( '#^/index\.php#', '/index.php/%lang%', $permastruct );
elseif ( is_multisite() && ! is_subdomain_install() && is_main_site() )
$permastruct = preg_replace( '#^/blog#', '/%lang%/blog', $permastruct );
@@ -513,4 +513,4 @@
return $post_rewrite;
}
-?>
\ No newline at end of file
+?>
@leanderlindahl
Copy link

Hi wokamoto. I'm trying to get my wordpress site working with bogo and nginx and have applied your patch, but my guess is I have to do something with 'location' in the server block as well. This is what I'm using – would you have any tips?

    location / {
            # First attempt to serve request as file, then
            # as directory, then fall back to displaying a 404.
            try_files $uri $uri/ @rewrite;
            # Uncomment to enable naxsi on this location
            # include /etc/nginx/naxsi.rules
    }

    location @rewrite {
            # Some modules enforce no slash (/) at the end of the URL
            # Else this rewrite block wouldn't be needed (GlobalRedirect)
            rewrite ^/(.*)$ /index.php?q=$1;
    }

@leanderlindahl
Copy link

This seems to do the job:

location / {
index index.php;
try_files $uri $uri/ /index.php$is_args$args;
}

https://wordpress.org/support/topic/bogo-on-nginx?replies=3#post-6453343

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment