Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code

Unified Diff: modules/web/templates/site.conf.erb

Issue 29474653: Remove trailing slashes from file URLs in web::server class (Closed)
Patch Set: Created June 26, 2017, 8:17 p.m.
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: modules/web/templates/site.conf.erb
diff --git a/modules/web/templates/site.conf.erb b/modules/web/templates/site.conf.erb
index 538ff66bb2d606b55393d2fc92d2f82e158e6959..b29701076adfef31e8ee1b67fb53b71d615ae689 100644
--- a/modules/web/templates/site.conf.erb
+++ b/modules/web/templates/site.conf.erb
@@ -46,6 +46,13 @@ location /
rewrite ^/$ /$index_page last;
rewrite ^/(\w\w(_\w\w)?)$ /$1/ permanent;
rewrite ^/(\w\w(_\w\w)?)/$ /$1/$index_page last;
+
+ # Remove accidental trailing slash
+
+ if (!-d "$document_root/$uri")
Wladimir Palant 2017/06/26 22:20:47 You probably want to do this only for actual files
mathias 2017/06/27 10:04:01 In fact i wanted to explicitly express that this i
+ {
+ rewrite ^(/.*)/$ $1 redirect;
Wladimir Palant 2017/06/26 22:20:47 In the case we are talking about (something that w
mathias 2017/06/27 10:04:01 Acknowledged.
+ }
}
<% if @multiplexer_locations %>
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld