I have installed WordPress multisite in sub-directory abc.com/en/
. I want to remove the trailing slash for SEO purposes. So pages like abc.com/en/xxx/
will be 301 redirected to abc.com/en/xxx
without a trailing slash.
After checking many resources (I am using Nginx), I found the code below to be working for all pages except the multisite homepage abc.com/en/
. WordPress always 301 redirects abc.com/en
to abc.com/en/
with a trailing slash, so it will cause a redirect loop.
if (!-d $request_filename) {
rewrite ^/(.*)/$ /$1 permanent;
}
So how can I remove the trailing slash for the en/
too? Many thanks in advance!