Note: This documentation is for version 1 of the Now platform. For the latest features, please see the version 2 documentation. If you have yet to upgrade, see the upgrade guide.

Setting up a Redirect with Now

You usually want your users to access your site with or without www. The best way to achieve this is to redirect all the traffic coming to the www domain to your app's naked domain.

Here are a few example redirects:

* ->
* ->

You can also add two aliases to your app like below:

now alias
now alias

It will do the job, but search engines consider them as duplicate content. This is not good for SEO and it might confuse users as well.

Therefore, www redirect is the best option. There are two ways to achieve that for your app.

Now we are going to deploy a simple web app which receives all the www traffic and redirect them to your naked domain.

To deploy this, run the following command:
(Make sure to add a trailing slash to the redirect URL as shown below.)

now -e REDIRECT_URL= now-examples/redirect

Then, you will get a deployment URL like this:

Now, alias that into your www domain like this:

now alias

Now, all the www traffic will be forwarded to your naked domain (in this case

You only need to deploy this app once.

In this case, your app accepts www traffic and it will redirect them from your app. If you are using Express for your app, you can do something like this:

function redirect(req, res, next) {
  // if the request doesn't come from or from the deployment URL
  if (req.hostname !== '' || req.hostname !== process.env.NOW_URL) {
    // redirect to keeping the pathname and querystring
    return res.redirect(`\${req.originalUrl}`);
  return next(); // call the next middleware (or route)

// make Express use our redirect middleware

If you are using some other language or a different web server, you can implement a similar logic as shown above.

Now, add an additional alias to receive www traffic into your app. If you are using now.json, you can add two aliases like this:

  "alias": [

Then, every time you run now alias, it will alias your app into both of your aliases.