为nginx重写wordpress 3.0(多站点)规则?
这是 WordPress 使用的新版本...
RewriteEngine On
RewriteBase 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]
它在 Nginx 中会是什么样子?
This is the new version being used by wordpress...
RewriteEngine On
RewriteBase 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?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
这取决于您想如何使用 WordPress 多站点。
对于带有子域的多站点 - http://rtcamp.com/tutorials/nginx -wordpress-multisite-subdomains-domain-mapping/
对于带有子目录的多站点 - http://rtcamp.com/tutorials/wordpress-nginx-multisite-subdirectories-nginx-map/
您将需要根据您计划使用的缓存插件/机制添加更多规则。 (参考)
It depends how do you want to use WordPress Multisite.
For Multisite with Subdomain - http://rtcamp.com/tutorials/nginx-wordpress-multisite-subdomains-domain-mapping/
For Multisite with Subdirectory - http://rtcamp.com/tutorials/wordpress-nginx-multisite-subdirectories-nginx-map/
You will need to add some more rules depending on which cache plugin/mechanism you plan to use. (ref)