Adding a condition to remove trailing / from URLS
I am a attempting to follow the handy guide about HTTP redirects and have hit a road block. The guide is expecting me to know the condition to add for removing forward slashes from the end of the URLs. I have made a good attempt at researching online and I have come up with the following condition:
(req.url ~ “/”) set req.http.host = regsuball(req.url, “”);
I am understandably reluctant to save and apply this incase it caused any problems. Would someone be able to confirm this is written correctly and will achieve what I am trying to do?
(basically we have 2 instances of our website being indexed by Google - normal and all url’s with a / at the end. Fastly have advised this can be remedied at the ‘edge’ and provided the HTTP redirect guide)
Thank you muchly in advance.
Please sign in to leave a comment.