开发者

Wordpress 3.0 conversion of .htaccess to nginx rewrite rules

开发者 https://www.devze.com 2022-12-31 01:37 出处:网络
RewriteEngine On RewriteBase开发者_Go百科 BASE/ #uploaded files RewriteRule ^(.*/)?files/$ index.php [L]
RewriteEngine On
RewriteBase开发者_Go百科 BASE/

#uploaded files
RewriteRule ^(.*/)?files/$ index.php [L]
RewriteCond %{REQUEST_URI} !.*wp-content/plugins.*
RewriteRule ^(.*/)?files/(.*) wp-includes/ms-files.php?file=$2 [L]

# add a trailing slash to /wp-admin
RewriteCond %{REQUEST_URI} ^.*/wp-admin$
RewriteRule ^(.+)$ $1/ [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]

What would it look like in Nginx?

Thank you very much,

Eiso


Try this plugin and nginx config for it: http://wordpress.org/extend/plugins/nginx-compatibility/other_notes/


You should try in your configuration file. That work for me :

location / {
        index index.html index.php;
        # URLs that don't exist go to WordPress /index.php PHP FastCGI
        if (!-e $request_filename) {
            rewrite ^.* /index.php break;
            fastcgi_pass 127.0.0.1:9001;
        }

http://www.farinspace.com/wordpress-nginx-rewrite-rules/


There is a post here which gives rewrite rules: http://beatpanda.co.cc/blog/2010/05/16/wordpress-3-0-multisite-rewrite-rules-for-nginx/

However that one gives these errors when nginx starts:

root@xxx:/home/xxx/public_html/domain.com/public# /etc/init.d/nginx start Starting nginx: [emerg]: invalid number of arguments in "location" directive in /usr/local/nginx/sites-enabled/domain.com:33 nginx.

0

精彩评论

暂无评论...
验证码 换一张
取 消