如何使用HAProxy重定向特定的路径URL

时间:2018-09-26 13:46:58

标签: redirect url-redirection haproxy

您好,谢谢您的帮助。

我在旧网站上有一个博客,并且我尝试使用haproxy将所有帖子重定向到我在新网站上的新位置(301)。例如,我希望将https://www.something.com/golive重定向到https://www.work.somthing.com/golive/join

www.somthing.com/golive => https://www.work.something.com/golive/join

我写了类似

private List<object> GetQueryResult(List<object> items)
        {
            var nItems = new List<object>();
            //try to get more details
            foreach (var i in items)
            {
                string desc = GetLogDescription(i.NewValue, i.OldValue, i.Descripiton);
                var nItem = new
                {
                    LogId = i.LogId,
                    Timestamp = i.Timestamp,
                    TenantId = i.TenantId,
                    TenantName = i.TenantName,
                    UserId = i.UserId,
                    UserName = i.UserName,
                    Descripiton = i.Descripiton,
                    OldValue = i.OldValue,
                    NewValue = i.NewValue,
                    ExtDescription = desc
                };
                nItems.Add(nItem);
            }

            return nItems;
        }

0 个答案:

没有答案