Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use subdomain string as a part of redirection url #80

Open
gabyshev opened this issue Jul 12, 2016 · 1 comment
Open

Use subdomain string as a part of redirection url #80

gabyshev opened this issue Jul 12, 2016 · 1 comment

Comments

@gabyshev
Copy link

I'm not sure. Is there a way to get the current subdomain before redirecting?

For example:
request url:

abc.mysite.com/audio/song.mp3

And I want it to be redirected here

mysite.com/abc/audio/song.mp3
@marcosgz
Copy link

maybe something like:

r301 %r{^(/audio/(.*)}, lambda { |match, rack_env|
  subdomain = rack_env['SERVER_NAME'].split('.')[0]
  "http://mysite.com/#{subdomain}/audio/#{match[1]}"
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants