Add a trailing slash to a directory url

Paul A. Procacci pprocacci at datapipe.com
Wed Jun 8 20:39:36 CEST 2011


Hello,

The following isn't tested, but it assumes all your resources end with a 2 or 3 character extension to avoid adding a slash to those resources.

######################################################
if(req.url !~ "\..{2,3}$" && req.url !~ "/$"){
  set req.url = regsub(req.url, "$", "/");
}
######################################################

Maybe someone else has something better.

~Paul

On Wed, Jun 08, 2011 at 04:54:47PM +0100, Jim Bailey wrote:
> Hello,
>
> I have been looking through the docs and some of the archives but can not
> find anything helpful.  I need to configure Varnish to add a trailing "/"
> to directory urls for example www.example.org/somedir with Apache adds a
> trailing slash to make it www.example.com/somedir/ and the index.php is
> picked up by default.
>
> Is this possible in Varnish and could some one post examples or point to
> some relevant examples or docs?
>
>
> Regards Jim
>
>
> _______________________________________________
> varnish-misc mailing list
> varnish-misc at varnish-cache.org
> http://www.varnish-cache.org/lists/mailman/listinfo/varnish-misc


________________________________

This message may contain confidential or privileged information. If you are not the intended recipient, please advise us immediately and delete this message. See http://www.datapipe.com/about-us-legal-email-disclaimer.htm for further information on confidentiality and the risks of non-secure electronic communication. If you cannot access these links, please notify us by reply message and we will send the contents to you.




More information about the varnish-misc mailing list