summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichał Górny <mgorny@gentoo.org>2018-05-25 13:22:33 +0200
committerMichał Górny <mgorny@gentoo.org>2018-05-25 13:22:33 +0200
commit210577e95105a950f40367fbf748228d7c40c3f7 (patch)
tree138b7bd8730da2701cc2205cdd64a73aaa4010ed
parentAdd redirects for missing/extraneous trailing slashes (diff)
downloadfrontend-210577e95105a950f40367fbf748228d7c40c3f7.tar.gz
frontend-210577e95105a950f40367fbf748228d7c40c3f7.tar.bz2
frontend-210577e95105a950f40367fbf748228d7c40c3f7.zip
Add redirects for plain /threads and /messages URL
It is against the best practices to use URLs whose initial components trigger 404. Instead, cause 'empty' /threads and /messages to redirect to top page. Bug: https://bugs.gentoo.org/656386
-rw-r--r--ag-web.rb4
1 files changed, 4 insertions, 0 deletions
diff --git a/ag-web.rb b/ag-web.rb
index fc09fb6..2dc8fe7 100644
--- a/ag-web.rb
+++ b/ag-web.rb
@@ -101,6 +101,10 @@ get '/:list/' do
end
end
+get '/:list/(threads|messages)/?' do
+ redirect '/%s/' % [params[:list]]
+end
+
get '/:list/threads/:year-:month' do
redirect '/%s/threads/%s-%s/' % [params[:list], params[:year], params[:month]]
end