/ Published in: Apache
                    
                                        
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:
domain.com/username/
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...
                domain.com/username/
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...
                            
                                Expand |
                                Embed | Plain Text
                            
                        
                        Copy this code and paste it in your HTML
# 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
URL: http://twitter.com/lchoate
Comments
 Subscribe to comments
                    Subscribe to comments
                
                