Roine

Keep same URL in now.sh

January 24, 2019

In the world of static file hosting there are plenty of solutions. I picked now.sh. It’s free, easy to use and works well. I have had one problem with now.sh so far, it creates a new URL everytime you push. It’s a feature that I dont need in some cases, here’s how to solve. Put this in package.json:

{
  "scripts": {
    "deploy": "now && now alias && now remove YOUR_APP_NAME --safe -y"
  }
}

Replace YOUR_APP_NAME by the name of your app. Then go to your now.json and add/change:

{
  "name": "YOUR_APP_NAME",
  "alias": "YOUR_UNIQUE_SUBDOMAIN.now.sh"
}

Replace YOUR_UNIQUE_SUBDOMAIN by your unique subdomain. Then, run yarn deploy.