I have the htaccess rules below that work almost perfectly. When I load
http://localhost:8888/site/name/register/ it redirects to http://localhost:8888/site/name/fr/register/ as is intended.
But when I load http://localhost:8888/site/name/register (sans trailing slash) the redirect does not occur. I'm sure I just need to add a slash somewhere in the .htaccess rules but can not find where (adding it to the RewriteBase makes no difference).
RewriteEngine On
RewriteBase /site/name/
#some URI processing also occurs in routing.php!
RewriteCond $1 !^(fr|nl)$
#don't apply the rule to the assets folders
RewriteCond $1 !^css$
RewriteCond $1 !^js$
RewriteRule ^([^/]+)/.* /site/name/fr/$0 [L,R=301]
#Removes access to the system folder by users.
#Additionally this will allow you to create a System.php controller,
#previously this would not have been possible.
#'system' can be replaced if you have renamed your system folder.
RewriteCond %{REQUEST_URI} ^system.*
RewriteRule ^(.*)$ /index.php?/$1 [L]
#Checks to see if the user is attempting to access a valid file,
#such as an image or css document, if this isn't true it sends the
#request to index.php
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php?/$1 [L]
Note the site homepage is http://localhost:8888/site/name
How can I get the redirect to occur also at http://localhost:8888/site/name/register ?