Small static app to redirect one domain to another
Switch branches/tags
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Type Name Latest commit message Commit time
Failed to load latest commit information.


Small app to redirect traffic from one domain to another.


In manifest.yml, change TARGET_DOMAIN to the domain you want to redirect to. Change host to the hostname you want to redirect from.

$ cf push -f manifest.yml

That's it!


Instead of forking this repo to simply have a redirect to your app, you can copy these files to a redirects/<redirect-from-domain> dir in the app you're redirecting to. This way all the redirects to your app are stored in a single repo.

Then you can add a path property to the manifest file to make deployments easy.

memory: 64MB
name: cf-redirect
host: redirect-from-domain
path: ./redirects/

Now you can deploy like so.

$ cf push -f redirects/

A note on permanence

The redirect uses a temporary 302 redirect. In some cases you might want to use a permanent redirect, for example, when the application has been permanently assigned a new URI. Note that without any caching directive, browsers may cache this response indefinitely which makes it very difficult to re-use the old URI for anything else. If you choose to use the 301 redirect, we suggest you include cache control to prevent the 301 being cached indefinitely.

# in nginx.conf
expires 3600;
return 301 $scheme://$target_domain$request_uri;