[wp-trac] [WordPress Trac] #18852: Nginx rewrite rules
WordPress Trac
wp-trac at lists.automattic.com
Thu Jun 28 04:13:15 UTC 2012
#18852: Nginx rewrite rules
---------------------------+------------------
Reporter: johnbillion | Owner:
Type: enhancement | Status: new
Priority: normal | Milestone: 3.5
Component: Rewrite Rules | Version: 3.3
Severity: normal | Resolution:
Keywords: has-patch |
---------------------------+------------------
Comment (by devesine):
Unless I'm misreading, this looks like it only produces the rewrite rules
for single-site installs. Multisite subdomain also generates this for
mod_rewrite:
{{{
# uploaded files
RewriteRule ^files/(.+) wp-includes/ms-files.php?file=$1 [L]
}}}
and subdirectory generates this:
{{{
# 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]
# [...]
RewriteRule ^[_0-9a-zA-Z-]+/(wp-(content|admin|includes).*) $1 [L]
RewriteRule ^[_0-9a-zA-Z-]+/(.*\.php)$ $1 [L]
}}}
The [http://codex.wordpress.org/Nginx codex nginx page] has an example
which includes this (which are materially equivalent to what we've been
using in a number of production sites):
{{{
# Add trailing slash to */wp-admin requests.
rewrite /wp-admin$ $scheme://$host$uri/ permanent;
# Directives to send expires headers and turn off 404 error logging.
location ~* \.(js|css|png|jpg|jpeg|gif|ico)$ {
expires 24h;
log_not_found off;
}
# Pass uploaded files to wp-includes/ms-files.php.
rewrite /files/$ /index.php last;
if ($uri !~ wp-content/plugins) {
rewrite /files/(.+)$ /wp-includes/ms-files.php?file=$1 last;
}
# Rewrite multisite '.../wp-.*' and '.../*.php'.
if (!-e $request_filename) {
rewrite ^/[_0-9a-zA-Z-]+(/wp-.*) $1 last;
rewrite ^/[_0-9a-zA-Z-]+.*(/wp-admin/.*\.php)$ $1 last;
rewrite ^/[_0-9a-zA-Z-]+(/.*\.php)$ $1 last;
}
}}}
Should those multisite-specific rules be part of this patch as well?
--
Ticket URL: <http://core.trac.wordpress.org/ticket/18852#comment:6>
WordPress Trac <http://core.trac.wordpress.org/>
WordPress blogging software
More information about the wp-trac
mailing list