2
0
Fork 0
mirror of https://github.com/discourse/discourse.git synced 2025-09-10 21:01:33 +08:00

FEATURE: add a way to map arbitrary urls to a topic, post, or category. Useful for sites that have migrated to Discourse and want to redirect from their old site to Discourse with 301 redirects.

This commit is contained in:
Neil Lalonde 2014-08-28 15:09:36 -04:00
parent 8a6c4234fc
commit 14890a6002
9 changed files with 156 additions and 0 deletions

View file

@ -0,0 +1,12 @@
class PermalinksController < ApplicationController
skip_before_filter :check_xhr, :preload_json
def show
permalink = Permalink.find_by_url(params[:url])
if permalink && permalink.target_url
redirect_to permalink.target_url, status: :moved_permanently
else
raise Discourse::NotFound
end
end
end