# Manage PHP domains, aliases, and redirects

> Attach domains to a PHP service, add site aliases, change the primary domain, and configure redirects.

A domain must be linked to the PHP service before it can be used as a site's primary, alias, or redirect address.

## Link and verify a domain

Open **Dashboard → Services → your PHP service → Domains**. Claim a free AppLaunch subdomain or use **Add Domain → Add External Domain**. External domains require the displayed ownership TXT record and **Verify Ownership**.

Linking proves control of the domain. Routing is configured when you use the domain on a site. Follow [Connect an existing domain](/domains/connect-a-domain/) for the complete flow.

## Add an alias domain

An alias serves the same PHP application directly at another hostname.

1. Open **PHP Sites** and choose the site.
2. Open **Overview** and find **Alias Domains**.
3. Click the add action and choose an eligible linked domain.
4. Add the A record shown by AppLaunch at your DNS provider.
5. Wait for DNS propagation, then click **Link**.

AppLaunch verifies DNS, issues the certificate, and activates the alias. Cloudflare records should remain **DNS only** during verification.

An alias moves through a DNS-pending state before it is linked. The **Make Primary** action appears only after the alias has been linked successfully. Until then, use **Link** after correcting or waiting for DNS.

## Make an alias primary

Use **Make Primary** beside a linked alias. Confirm the change only after that alias works over HTTPS.

When you confirm the swap, AppLaunch:

1. Makes the selected alias the site's new primary domain.
2. Converts the previous primary domain into a redirect domain.
3. Sends visitors from the previous primary domain to the new primary domain.
4. Updates the hosting primary-domain and reverse-proxy configuration.

No downtime is expected, but existing connections may be interrupted briefly while the web server is reconfigured.

Changing the primary domain does not rewrite URLs stored inside your PHP application. Update the application's base URL, allowed hosts, callback URLs, cookies, and any hard-coded links yourself.

After the swap, test both addresses in a private browser window. The new primary should serve the application directly over HTTPS, while the old primary should redirect to it. Also test sign-in, form submissions, OAuth callbacks, webhooks, CORS rules, and secure cookies if the application uses them.

## Add a redirect domain

A redirect sends visitors to the site's primary domain instead of serving the application under two addresses.

1. Open **Overview → Redirect Domains**.
2. Add an eligible linked domain.
3. Create the displayed A record.
4. Click **Link** after the record propagates.

Use a redirect for an old brand, alternate spelling, or previous primary hostname. Use an alias only when the application must remain available under both addresses.

Redirect domains do not have a **Make Primary** action. If a redirect must become primary, remove it from **Redirect Domains**, add it under **Alias Domains**, complete its DNS and **Link** steps, confirm it works over HTTPS, and then select **Make Primary**. The domain cannot be assigned as both an alias and a redirect at the same time.

## Alias or redirect: which should you choose?

- Choose an **alias** when both domains must display the application directly.
- Choose a **redirect** when one domain should send visitors to the primary address.
- Choose **Make Primary** when a working alias should become the canonical address and the current primary should become the redirect automatically.

Using one canonical primary domain avoids duplicate public URLs. Update canonical tags, sitemaps, analytics, search-console properties, and any application-generated links after a primary-domain change.

## Remove a domain safely

Do not remove the current primary domain. First promote a working alias. Removing an alias stops that hostname from serving the application; removing a redirect stops visitors on that hostname from reaching the primary site. Removing a linked domain can also break certificates, email callbacks, and third-party integrations that still use it.

For DNS errors, see [Troubleshoot domains and DNS](/domains/troubleshooting/).
