# urbestack-domain-redirect-add

First published 3 Oct 2026 (release 0.1.0) · Unchanged since publication

UrbeStack release 0.2.35 command, run as root in the server shell.

## Usage

```
urbestack-domain-redirect-add --name DOMAIN --source PATH --target URL-OR-PATH [--code 301|302] [--match prefix|exact] [--keep-query on|off] [--dry-run]
```

## Description

Adds an HTTP redirect from a path on a domain. Use --source /old for a path on the domain. The default, --match prefix, redirects the source path and everything beneath it. With that match type, --source / redirects the whole site. Use --match exact to redirect only the specified path.

Set --target to a path starting with / on the same domain or an absolute HTTP or HTTPS URL. Leave query strings and fragments out of the target. The redirect keeps the request's query string by default. Use --keep-query off to drop it. The default status code is 301 for a permanent redirect. Use --code 302 for a temporary redirect.

A prefix redirect rejects a site-relative target equal to or beneath its source path. Each source path can have one redirect of each match type.

## Same in the API

- [POST /domains/{name}/redirects](https://urbestack.com/docs/api/post-domains-name-redirects.md): Add a path redirect to a domain

## Command family: domain

- [urbestack-domain-add](https://urbestack.com/docs/commands/urbestack-domain-add.md): Adds a hosted domain to a customer account.
- [urbestack-domain-alias-add](https://urbestack.com/docs/commands/urbestack-domain-alias-add.md): Adds an alias to an existing domain so Apache serves both names from the same document root.
- [urbestack-domain-alias-del](https://urbestack.com/docs/commands/urbestack-domain-alias-del.md): Removes an alias and updates Apache, DNS and mail configuration.
- [urbestack-domain-del](https://urbestack.com/docs/commands/urbestack-domain-del.md): Deletes a domain and its subdomains, along with their Apache virtual hosts, PHP-FPM pools, mailboxes, certificates and statistics.
- [urbestack-domain-list](https://urbestack.com/docs/commands/urbestack-domain-list.md): Lists domains in name order or returns a single domain by name.
- [urbestack-domain-log](https://urbestack.com/docs/commands/urbestack-domain-log.md): Reads a domain's access, error or PHP error log.
- [urbestack-domain-modsec-set](https://urbestack.com/docs/commands/urbestack-domain-modsec-set.md): Sets the ModSecurity mode or the owner's choice for a domain.
- [urbestack-domain-modsec-show](https://urbestack.com/docs/commands/urbestack-domain-modsec-show.md): Shows the server's ModSecurity mode, the administrator's mode for the domain, the owner's choice and the mode in force.
- [urbestack-domain-redirect-del](https://urbestack.com/docs/commands/urbestack-domain-redirect-del.md): Removes redirects for a source path on a domain.
- [urbestack-domain-set](https://urbestack.com/docs/commands/urbestack-domain-set.md): Changes settings for an existing domain and synchronizes the DNS zones UrbeStack manages.
