Return to Snippet

Revision: 61387
at December 9, 2012 08:10 by lucasoptura

Initial Code
# BEGIN WordPress
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).*) $1 [L]
RewriteRule  ^[_0-9a-zA-Z-]+/(.*\.php)$ $1 [L]

#So far, we've not found a real file, folder or virtual folder with this URL, add a slash and call 404 so my API can fulfil the request.
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_URI} !(.*)/$
RewriteRule ^(.*[^/])$ /$1/ [L,R=301]

RewriteRule . index.php [L]

# END WordPress

Initial URL

Initial Description
In my WP networks, I use a custom 404 page and plugin to answer calls asking for user information from a custom api. The API requires a URL format like this:
However, users don't ever type a trailing slash, nor should they, so this allows for a trailing slash anywhere but inside admin, except where it is needed in admin...

Initial Title
.htaccess for wordpress network @wpengine - adds trailing slash to 404 pages

Initial Tags
php, wordpress, htaccess

Initial Language