DEV Community

What's the proper way to move website to a new address?

Pacharapol Withayasakpunt on March 15, 2020

Say, you have initially deploy the website on GitHub Pages, but you want to move to Netlify or Heroku. Perhaps, totally destroy the old website, a...
Collapse
 
roelofjanelsinga profile image
Roelof Jan Elsinga

If there is a way that you can keep the GitHub Pages for now, then you can set the canonical url of the page to the new website. Google won't punish you (as much) for it. I don't know if this would help in your case, but it might safe your SEO.

Collapse
 
patarapolw profile image
Pacharapol Withayasakpunt • Edited

Not sure if it helps, but my _config.yml is now.

gems:
  - jekyll-redirect-from
url: https://polvcode.dev

I think that if I don't use Jekyll, I cannot get 301...

Not sure if I can use rel=canonical in Jekyll Markdown...

Collapse
 
roelofjanelsinga profile image
Roelof Jan Elsinga

You should be able to, if you can edit any of the elements within

then you can add it. I'm using Jekyll as well and I'm able to do it. What's the link to your repo? I can have a look tomorrow and create a pull request if it's possible.
Thread Thread
 
patarapolw profile image
Pacharapol Withayasakpunt
Collapse
 
supunkavinda profile image
Supun Kavinda

I'm not sure if it helps. Normally, Google shows the higher domain rank site even the canonicals are set. (Try publishing a post on your blog and DEV on the same day. DEV post will appear even you add canonical).

The recommended way is using the domain migrate tool in the Google search console. However, you cannot do that because it's on Guthub.io

 
patarapolw profile image
Pacharapol Withayasakpunt

I cannot be really sure about that, so I create both index.md and 404.md with the same contents, just in case.

---
redirect_to: "https://polvcode.dev"
---

And of course,

gems:
  - jekyll-redirect-from

How do I ensure that the code is really 301?

Collapse
 
supunkavinda profile image
Supun Kavinda • Edited

Hey! I got this idea.

Github allows you to set custom domain right? (Tutorial)

Add a custom domain first. Then, your Github will automatically redirect your traffic to custom domain (I think).

After that, set up Google search console and add your domain.

After that, you can migrate to whatever host you need. You don't have to redirect because the domain is the same.

What do you think?

Collapse
 
patarapolw profile image
Pacharapol Withayasakpunt

Not sure if I understand, but every steps, like pointing domain to GitHub seems to take time...

Collapse
 
patarapolw profile image
Pacharapol Withayasakpunt

Can't do that with GitHub Pages BTW. It just has to be either 200 (found a file) or 404.html.

 
patarapolw profile image
Pacharapol Withayasakpunt • Edited

Not working for non-root. It still says 404. (Although it does redirect, and says 301 later.)

See patarapolw.github.io/blog/post/ele...

Collapse
 
saxode profile image
Saxode • Edited

Pretty Cool!