All threads / Change Domain of Server?

Ask A Question

Notifications

You’re not receiving notifications from this thread.

Change Domain of Server?

Ketan Anjaria asked in Servers

I have an app at site.co but I just bought site.com
How do I set it up where all previous links to site.co redirect to site.com?
ie site.co/username should redirect to site.com/username

The steps required depend on what server you're using but basically you're just changing your server configuration so it responds to the new domain. I use nginx and something like the following would work:
server {
listen 80;
server_name old.example.com;
return 301 http://new.example.com$request_uri;
}
I'm on mobile and can't select to do that in a code block. What this block does is send a 301 which states the content has moved. Anything in search engines or bookmarked wont suddenly stop working

Join the discussion

Want to stay up-to-date with Ruby on Rails?

Join 34,674+ developers who get early access to new tutorials, screencasts, articles, and more.

    We care about the protection of your data. Read our Privacy Policy.

    logo Created with Sketch.

    Ruby on Rails tutorials, guides, and screencasts for web developers learning Ruby, Rails, Javascript, Turbolinks, Stimulus.js, Vue.js, and more. Icons by Icons8

    © 2020 GoRails, LLC. All rights reserved.