[Sugester V2 EN](https://sugester.intum.pl/kb/sugester-v2-en.md) / [CMS](https://sugester.intum.pl/kb/sugester-v2-en/cms.md)

# [Domains and website configuration](https://sugester.intum.pl/kb/sugester-v2-en/domains-and-website-configuration.md)

How to connect your own domain to the CMS website.

## Requirements

1. Own domain (e.g. mojafirma.pl)
2. Access to DNS settings
3. CMS website in Sugester 2

## Step 1: DNS Configuration

At your domain registrar, add the record:

### For the main domain (mojafirma.pl):
```
Type: A
Name: @ (or empty)
Value: 63.35.155.0
TTL: 3600
```

### For the subdomain (app.mojafirma.pl):
```
Type: CNAME
Name: app
Value: app.mojafirma.pl
TTL: 3600
```

## Step 2: Adding the domain in Sugester 2

### Through UI:
1. Go to **Settings → Domains**
2. Click **Add domain**
3. Enter the domain (e.g. `mojafirma.pl`)
4. Select type: **CMS Site**
5. Choose the website

### Through API:
```bash
curl -X POST "https://domena.com/account/domains.json?api_token=TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "domain": {
      "domain": "mojafirma.pl",
      "subject_type": "Cms::Site",
      "subject_id": 1018
    }
  }'
```

## Step 3: SSL (automatic)

Sugester 2 automatically generates a Let's Encrypt certificate after:
1. Correct DNS configuration
2. Adding the domain in the panel
3. The first HTTPS request

DNS propagation time: up to 48h (usually a few minutes).

## Multiple domains for one website

You can assign multiple domains to the same website:
- `mojafirma.pl` → Site: MojaFirma-marketing
- `www.mojafirma.pl` → Site: MojaFirma-marketing

## Redirects

For redirecting www → non-www or vice versa, configure both domains and set up the redirect in DNS or the server.

## Troubleshooting

### Domain not working
1. Check DNS propagation: `dig mojafirma.pl`
2. Check if the domain is added in Sugester 2
3. Wait for propagation (up to 48h)

### SSL error
1. Ensure DNS points to Sugester 2
2. Wait 5-10 minutes for the certificate to be generated
3. Clear browser cache

### 404 Page
1. Check if the Site has assigned Pages
2. Check if the Page has the correct `path` (empty for the homepage)

## List of domains

```bash
curl "https://domena.com/account/domains.json?api_token=TOKEN"
```

## Deleting a domain

```bash
curl -X DELETE "https://domena.com/account/domains/ID.json?api_token=TOKEN"
```