views:

133

answers:

1

My Wordpress 3 multiuser has been enabled, but I don't know how to rewrite the following .htaccess rules for nginx:

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]

Any hints?

A: 

These codes do not work:(I have done some changes with them, but still not work in wordpress3.0.1)

    rewrite ^index\.php$ - last;

    # uploaded files
    rewrite ^([_0-9a-zA-Z-]+/)?files/(.+) wp-includes/ms-files.php?file=$2 last;

    # add a trailing slash to /wp-admin
    rewrite ^([_0-9a-zA-Z-]+/)?wp-admin$ $1wp-admin/ permanent;

    if ( -e $request_filename ) {
            rewrite ^ - last;
            rewrite ^([_0-9a-zA-Z-]+/)?(wp-(content|admin|includes).*) $2 last;
            rewrite ^([_0-9a-zA-Z-]+/)?(.*\.php)$ $2 last;
            rewrite . index.php last;
    }

I have tried it

I built wordpress3.0.1 in virtualbox with apache2, just finding the .htaccess file was shown below:

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

RewriteCond %{REQUEST_FILENAME} !-f [OR]
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . index.php [L]

so the nginx rewrite rule should be those:

location ~ / {
    rewrite ^index\.php$ - last;
    if( !-e $request_filename ) {
        rewrite . /index.php last;
    }
}

and this works!

HCOONa
Perfect! Thanks!
Kirk
It did work yesterday, but failed just when I restart nginx. I am trying to fix it.
HCOONa
HCOONa