https://github.com/johnantoni/subdir_redirect
take the subdomain value, remove the root name and keep the end value then redirect. so subdir.site.ca => subdir.ca
https://github.com/johnantoni/subdir_redirect
Last synced: over 1 year ago
JSON representation
take the subdomain value, remove the root name and keep the end value then redirect. so subdir.site.ca => subdir.ca
- Host: GitHub
- URL: https://github.com/johnantoni/subdir_redirect
- Owner: johnantoni
- Created: 2012-10-30T18:38:52.000Z (almost 14 years ago)
- Default Branch: master
- Last Pushed: 2012-10-30T18:42:07.000Z (almost 14 years ago)
- Last Synced: 2025-02-05T19:08:48.498Z (over 1 year ago)
- Language: Ruby
- Size: 97.7 KB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# subdir_redirect
## Description
Another change to kjohnston's naked_redirect so all subdomains & naked domains redirect to => www.mydomain.com
A Sinatra app that converts the subdomain value to a domain and redirects to that.
For example, a request for `http://subdir.domain.ca` would be redirected to `http://www.subdir.ca`.
## Behavior
The protocol, host and query string are preserved during redirections. However, the app only responds to GET requests.
## Deployment
This app is easily deployable to Heroku, but you can run it anywhere you can run a Rack app.
The app will redirect any domain pointed to it, so you'll just need to create an A record pointing to the IP where the app is hosted for each domain you want it to handle redirection for.
## License
* Freely distributable and licensed under the [MIT license](http://kjohnston.mit-license.org/license.html).
* Copyright (c) 2012 Kenny Johnston [](http://coderwall.com/kjohnston)
* Copyright (c) 2012 John Griffiths [](http://coderwall.com/johnantoni)