From 163c8632a5baff970805471a6168c5645c2db00f Mon Sep 17 00:00:00 2001 From: Ugnich Anton Date: Wed, 9 Jul 2014 14:58:14 +0700 Subject: Tags synonyms redirect --- src/java/com/juick/http/www/Discover.java | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'src/java/com/juick/http') diff --git a/src/java/com/juick/http/www/Discover.java b/src/java/com/juick/http/www/Discover.java index ff4b3ee5..ca78f41e 100644 --- a/src/java/com/juick/http/www/Discover.java +++ b/src/java/com/juick/http/www/Discover.java @@ -43,6 +43,14 @@ public class Discover { if (paramTag == null) { Errors.doGet404(sql, request, response); return; + } else if (paramTag.SynonymID > 0 && paramTag.TID != paramTag.SynonymID) { + com.juick.Tag synTag = TagQueries.getTag(sql, paramTag.SynonymID); + String url = "/tag/" + URLEncoder.encode(synTag.Name, "UTF-8"); + if (request.getQueryString() != null) { + url += "?" + request.getQueryString(); + } + Utils.sendPermanentRedirect(response, url); + return; } else if (!paramTag.Name.equals(paramTagStr)) { String url = "/tag/" + URLEncoder.encode(paramTag.Name, "UTF-8"); if (request.getQueryString() != null) { -- cgit v1.2.3