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

Apply rewrite rule only to certain domain #85

Open
cmalpeli opened this issue Mar 6, 2017 · 2 comments
Open

Apply rewrite rule only to certain domain #85

cmalpeli opened this issue Mar 6, 2017 · 2 comments

Comments

@cmalpeli
Copy link

cmalpeli commented Mar 6, 2017

My app serves up multiple domains. Is there a way to scope the rewrite to only one of them.

Essentially something that would allow this:

r301 'http://www.domain1.com/something', 'some-other-location'

So http://www.domain1.com/something would redirect, but http://www.domain2.com/something would not.

@ShaneBoyer
Copy link

https://github.com/jtrupiano/rack-rewrite#host should work

@cmalpeli
Copy link
Author

@ShaneBoyer this solution doesn't actually seem to work for my case.

I've got:

r301 "/app", "/some-marketing-url", host: "www.domain1.com"
r301 "/app", "/another-marketing-url", host: "www.domain2.com"

The first rule applies. But the second redirect gets caught up by the first rule.....

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