简体   繁体   中英

Redirecting subdomain for static assets on Heroku

I would like myapp.com/blog to redirect to www.myapp.com/blog. I've installed Refraction to do subdomain redirects at the Rack layer. That doesn't work on Heroku for /blog since my files in /blog are static assets. Any fix?

Sounds like you may be making this more difficult than it needs to be.

If you just want myapp.com/something to redirect to www.myapp.com/something , then goto the domain host that is currently handling the myapp.com domain and create a URL redirect record to do just that. This way, the redirect happens at the domain registrar before it even touches your Heroku server (which is how it should be handled).

An example of this would be to create the following records at your domain registrar (ie GoDaddy, NameCheap, etc): http://i.imgur.com/FJrMV.png

Those 3 IP addresses point to Heroku's servers. You should have already set up the custom domain add-on within Heroku if indeed you have some site similar to myapp.com and not myapp.heroku.com

Here's an article / video from Heroku that deals with a little bit of this as well: http://devcenter.heroku.com/articles/custom-domains

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM