mirror of
https://github.com/discourse/discourse.git
synced 2025-05-22 04:11:12 +08:00
FEATURE: add clean support for running Discourse in a subfolder
To setup set DISCOURSE_RELATIVE_URL_ROOT to the folder you wish
This commit is contained in:
@ -4,7 +4,7 @@ class StaticController < ApplicationController
|
||||
skip_before_filter :verify_authenticity_token, only: [:enter]
|
||||
|
||||
def show
|
||||
return redirect_to('/') if current_user && params[:id] == 'login'
|
||||
return redirect_to(path '/') if current_user && params[:id] == 'login'
|
||||
|
||||
map = {
|
||||
"faq" => {redirect: "faq_url", topic_id: "guidelines_topic_id"},
|
||||
@ -60,15 +60,17 @@ class StaticController < ApplicationController
|
||||
params.delete(:username)
|
||||
params.delete(:password)
|
||||
|
||||
destination = "/"
|
||||
destination = path("/")
|
||||
|
||||
if params[:redirect].present? && !params[:redirect].match(login_path)
|
||||
begin
|
||||
forum_uri = URI(Discourse.base_url)
|
||||
uri = URI(params[:redirect])
|
||||
|
||||
if uri.path.present? &&
|
||||
(uri.host.blank? || uri.host == forum_uri.host) &&
|
||||
uri.path !~ /\./
|
||||
|
||||
destination = uri.path
|
||||
end
|
||||
rescue URI::InvalidURIError
|
||||
|
Reference in New Issue
Block a user