<div dir="ltr"><div class="gmail_extra"><br><div class="gmail_quote">On Tue, Oct 13, 2015 at 6:09 AM, Andrew Hutchings <span dir="ltr"><<a href="mailto:ahutchings@nginx.com" target="_blank">ahutchings@nginx.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">Hi!<br>
<span class=""><br>
On Tuesday 13 October 2015 08:59:02 steve wrote:<br>
> Hi folks,<br>
><br>
> I have a requirement from a customer that the terminal slash be<br>
> rewritten when accessing the homepage - eg <a href="http://example.com/" rel="noreferrer" target="_blank">example.com/</a> is a 301 to<br>
> <a href="http://example.com" rel="noreferrer" target="_blank">example.com</a><br>
><br>
> I've tried a simple rewrite of ^/$ but that just loops.<br>
><br>
> Any ideas?<br>
<br>
</span>As you have seen in other answers this will be pretty much impossible to get<br>
right. Have you considered writing some Javascript to do it client side<br>
instead? Something like this:<br>
<br>
<a href="http://stackoverflow.com/questions/10953792/change-url-in-browser-address-bar-without-reload-existing-page" rel="noreferrer" target="_blank">http://stackoverflow.com/questions/10953792/change-url-in-browser-address-bar-without-reload-existing-page</a><br>
<br>
At least then (in theory) you can have the illusion of hiding the trailing<br>
slash without risking breaking browser support for the site.<br></blockquote><div><br></div><div>You can set a canonical URL if your intention is for SEO. This is the standard practice. </div><div><br></div><div><a href="https://moz.com/learn/seo/canonicalization">https://moz.com/learn/seo/canonicalization</a> <br></div><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">
<br>
Kind Regards<br>
<span class=""><font color="#888888">--<br>
Andrew Hutchings (LinuxJedi)<br>
Senior Developer Advocate, NGINX Inc.<br>
</font></span><div class=""><div class="h5"><br>
_______________________________________________<br>
nginx mailing list<br>
<a href="mailto:nginx@nginx.org">nginx@nginx.org</a><br>
<a href="http://mailman.nginx.org/mailman/listinfo/nginx" rel="noreferrer" target="_blank">http://mailman.nginx.org/mailman/listinfo/nginx</a><br>
</div></div></blockquote></div><br></div></div>