# Landing Page Redirects Documentation

**Last Updated:** 2026-04-02

Comprehensive documentation for old landing page URL redirects to `/v2` with parameter preservation.

## Overview

All outdated landing page URLs are permanently redirected (301) to `/v2` while preserving all query parameters (UTM tags, partner parameters, etc.). This ensures campaign tracking, partner attribution, and analytics continue to work correctly after the redirect.

## Redirected URLs

The following old landing page paths redirect to `/v2`:

- `/lp` - Legacy landing page
- `/lpp` - Legacy partner page
- `/lpp-gastronomie` - Legacy partner page (gastronomy)
- `/l` - Legacy landing page variant 1
- `/l2` - Legacy landing page variant 2
- `/l3` - Legacy landing page variant 3
- `/ad` - Legacy ad landing page

## Parameter Mapping

Old landing pages used path parameters that are converted to query parameters in the redirect:

| Old Path Parameter | New Query Parameter | Notes |
|-------------------|---------------------|-------|
| `h1` | `title` | Headline/title parameter |
| `text` | `text` | Text parameter (preserved as-is) |
| `industry` | `industry` | Industry parameter (preserved as-is) |
| `partner` | `partner` | Partner parameter (preserved as-is) |

## Redirect Rules

All redirects use the following Apache `.htaccess` flags:

- **`R=301`** - Permanent redirect (SEO-friendly)
- **`L`** - Last rule (stop processing)
- **`QSA`** - Query String Append (preserve existing query parameters)

### Redirect Examples

#### Base Redirects (No Path Parameters)

```
/lp → /v2
/lpp → /v2
/lpp-gastronomie → /v2
/l → /v2
/l2 → /v2
/l3 → /v2
/ad → /v2
```

#### Redirects with Path Parameters

```
/lp/test-title → /v2?title=test-title
/lp/test-title/test-text → /v2?title=test-title&text=test-text
/l/gastronomie → /v2?industry=gastronomie
/l/gastronomie/partner-name → /v2?industry=gastronomie&partner=partner-name
/l/gastronomie/partner-name/custom-title → /v2?industry=gastronomie&partner=partner-name&title=custom-title
/l/gastronomie/partner-name/custom-title/custom-text → /v2?industry=gastronomie&partner=partner-name&title=custom-title&text=custom-text
```

#### Redirects with Query Parameters (UTM Tags, Partner Params)

```
/lp?utm_source=google&utm_campaign=test → /v2?utm_source=google&utm_campaign=test
/lp/test-title?utm_source=google&utm_campaign=test → /v2?title=test-title&utm_source=google&utm_campaign=test
/l/gastronomie/partner-name?utm_source=ad&leadSource=Partner → /v2?industry=gastronomie&partner=partner-name&utm_source=ad&leadSource=Partner
```

#### Complex Combinations

```
/ad/test-title/test-text?utm_source=facebook&utm_campaign=ad-campaign&partner=test-partner
→ /v2?title=test-title&text=test-text&utm_source=facebook&utm_campaign=ad-campaign&partner=test-partner

/l2/gastronomie/partner-name/custom-title/custom-text?utm_source=google&utm_medium=cpc&utm_campaign=test
→ /v2?industry=gastronomie&partner=partner-name&title=custom-title&text=custom-text&utm_source=google&utm_medium=cpc&utm_campaign=test
```

## Paid Landing Page Variations (lp_ Parameters)

The paid landing pages `/gastro` and `/schichtbetriebe` support dynamic content via `lp_`-prefixed URL parameters. These allow the Ads manager to customize hero content (title, h1, subhead, bullets) per campaign.

- **Base URLs:** `https://www.ordio.com/gastro`, `https://www.ordio.com/schichtbetriebe`
- **Parameters:** `lp_h1`, `lp_h1_sub`, `lp_title`, `lp_desc`, `lp_subhead`, `lp_body`, `lp_bullet1`, `lp_bullet2`, `lp_bullet3`
- **QSA:** Both routes use `[L,QSA]` in `.htaccess`, so all query parameters (including `lp_*` and UTM) are preserved

See `docs/systems/paid-landing-variations/PAID_LANDING_VARIATIONS.md` for full parameter reference and Google Ads setup.

## Query Parameter Preservation

The `QSA` (Query String Append) flag ensures that all existing query parameters are preserved during the redirect:

- **UTM Parameters**: `utm_source`, `utm_campaign`, `utm_medium`, `utm_term`, `utm_content`
- **Partner Parameters**: `partner`, `leadSource`
- **Paid Landing Variations**: `lp_h1`, `lp_subhead`, `lp_title`, etc. (see above)
- **Custom Parameters**: Any other query parameters passed in the original URL

### Example: Campaign Tracking

If a user clicks a link from an ad campaign:
```
https://www.ordio.com/lp?utm_source=google&utm_campaign=summer-sale&utm_medium=cpc
```

They are redirected to:
```
https://www.ordio.com/v2?utm_source=google&utm_campaign=summer-sale&utm_medium=cpc
```

All UTM parameters are preserved, ensuring accurate campaign tracking in analytics.

### Example: Partner Attribution

If a partner sends traffic with partner parameters:
```
https://www.ordio.com/l/gastronomie/partner-name?partner=gastroberatung&leadSource=Partner%20recommendation
```

They are redirected to:
```
https://www.ordio.com/v2?industry=gastronomie&partner=gastroberatung&leadSource=Partner%20recommendation
```

Both path parameters (`industry`, `partner`) and query parameters (`leadSource`) are preserved, ensuring partner attribution continues to work.

## Implementation Details

### Apache .htaccess Rules

Redirect rules are located in `.htaccess` at lines 621-654 (as of 2026-01-20).

**Pattern Structure:**
```apache
# Base redirect (no path parameters)
RewriteRule ^old-path\/?$ /v2 [R=301,L,QSA]

# Redirect with single path parameter
RewriteRule ^old-path\/([^\/]*)$ /v2?new-param=$1 [R=301,L,QSA]

# Redirect with multiple path parameters
RewriteRule ^old-path\/([^\/]*)\/([^\/]*)$ /v2?param1=$1&param2=$2 [R=301,L,QSA]
```

**Key Points:**
- `[^\/]*` - Matches any characters except forward slash (non-greedy)
- `$1`, `$2`, etc. - Backreferences to captured groups
- `QSA` - Appends existing query string to the redirect target

### Parameter Conversion Logic

1. **Path parameters** are extracted from the URL path using regex capture groups
2. **Path parameters** are converted to query parameters in the redirect target
3. **Existing query parameters** are preserved using the `QSA` flag
4. **Parameter mapping** (`h1` → `title`) is handled in the redirect target

## Testing

### Manual Testing

Test redirects using `curl`:

```bash
# Base redirect
curl -I -L "http://localhost:8003/lp"

# Redirect with path parameters
curl -I -L "http://localhost:8003/lp/test-title"

# Redirect with query parameters
curl -I -L "http://localhost:8003/lp?utm_source=google&utm_campaign=test"

# Complex combination
curl -I -L "http://localhost:8003/l/gastronomie/partner-name?utm_source=ad&leadSource=Partner"
```

### Automated Testing

Use the Python test script:

```bash
python3 v2/scripts/dev-helpers/test-landing-page-redirects.py
python3 v2/scripts/dev-helpers/test-landing-page-redirects.py --base-url http://localhost:8003
```

The test script validates:
- Base redirects (no parameters)
- Redirects with path parameters
- Redirects with query parameters
- Complex combinations (path + query parameters)
- Parameter mapping correctness
- Query string preservation

## SEO Considerations

### Permanent Redirects (301)

All redirects use `R=301` (permanent redirect) which:
- Signals to search engines that the content has permanently moved
- Transfers SEO value (PageRank, link equity) from old URLs to `/v2`
- Prevents duplicate content issues

### URL Structure

The redirect maintains clean URLs:
- Old: `/lp/test-title?utm_source=google`
- New: `/v2?title=test-title&utm_source=google`

Both URLs are SEO-friendly and maintain tracking parameters.

## Maintenance

### Adding New Redirects

When adding new redirect rules:

1. **Place rules before catch-all rules** - Redirect rules should come before general rewrite rules
2. **Use specific patterns first** - More specific patterns (with more path segments) should come before less specific ones
3. **Always include QSA flag** - Preserve query parameters unless explicitly removing them
4. **Test thoroughly** - Test with various parameter combinations

### Modifying Existing Redirects

When modifying redirect rules:

1. **Test before deploying** - Use the test script to validate changes
2. **Check parameter mapping** - Ensure path parameters map correctly to query parameters
3. **Verify query preservation** - Confirm existing query parameters are preserved
4. **Update documentation** - Update this documentation if parameter mapping changes

## Related Documentation

- [Partner Pages System Guide](../partner-pages/PARTNER_PAGES_GUIDE.md) - Partner parameter handling
- [UTM Tracking Documentation](../../development/UTM_TRACKING.md) - UTM parameter tracking
- [Apache .htaccess Best Practices](../../development/HTACCESS_BEST_PRACTICES.md) - Redirect best practices

## Troubleshooting

### Redirect Not Working

1. **Check Apache mod_rewrite** - Ensure `mod_rewrite` is enabled
2. **Verify .htaccess location** - Ensure `.htaccess` is in the document root
3. **Check rule order** - Ensure redirect rules come before catch-all rules
4. **Test with curl** - Use `curl -I` to see redirect headers

### Parameters Not Preserved

1. **Check QSA flag** - Ensure `QSA` flag is present in redirect rule
2. **Verify query string** - Check that original URL has query parameters
3. **Test manually** - Use curl to verify parameter preservation

### Parameter Mapping Issues

1. **Check regex patterns** - Ensure capture groups match correctly
2. **Verify backreferences** - Check that `$1`, `$2`, etc. are used correctly
3. **Test parameter mapping** - Use test script to validate mapping

## Blog Redirects

### Lexikon Pagination

The Lexikon page uses a single-page A–Z index. Pagination URLs redirect to the main index:

| Source | Destination | Notes |
|--------|-------------|-------|
| `/insights/lexikon/page/2/` | `/insights/lexikon/` | 301, QSA preserved |
| `/insights/lexikon/page/N/` | `/insights/lexikon/` | Any page number |

**Implementation:** `.htaccess` (before category rules) and fallback in `v2/pages/blog/category.php`.

**See:** `docs/content/blog/LEXIKON_INDEX_PAGE.md` for Lexikon architecture.

## Partner Program Redirects

Canonical URL for the Ordio Loop partner program is `/partner`. Legacy URLs redirect with QSA:

| Source | Destination |
|--------|-------------|
| `/partnerprogramm` | `/partner` |
| `/partner-program` | `/partner` |

**Implementation:** `.htaccess` (Affiliate Partner Program section).

## HTTPS and www canonicalization

**Purpose:** Permanent (301) consolidation to `https://www.ordio.com` when the request hits Apache as HTTP and/or on apex host `ordio.com`.

| Condition | Destination |
|-----------|-------------|
| Host `ordio.com` (any scheme path/query) | `https://www.ordio.com` + same path/query (QSA) |
| Host `www.ordio.com` + `HTTPS off` | `https://www.ordio.com` + same path/query (QSA) |

**Implementation:** `.htaccess` immediately after `RewriteBase /`.

**Note:** If TLS terminates at a reverse proxy/CDN and Apache always sees `HTTPS=on`, configure the same canonical behavior at the edge so plain HTTP clients still get **301** (not **302**) where possible.

## Product page: Schichtplan draft URL → canonical

- **`/schichtplan-neu` → `/schichtplan`** — **301**, **`QSA`** (preserves UTM and campaign params). **`/schichtplan`** rewrites to `product_schichtplan_neu.php`.
- **Archived template** `v2/pages/product_shiftplan.php` — **no public route**. Direct request **`/v2/pages/product_shiftplan.php`** → **403** (see `.htaccess` internal PHP block). Not in sitemap; do not link.

## Changelog

### 2026-04-02
- Schichtplan: `/schichtplan-neu` → `/schichtplan` (301, QSA); `/schichtplan` → `product_schichtplan_neu.php`. Archived `product_shiftplan.php` has **no** clean URL — direct `/v2/pages/product_shiftplan.php` → **403** (replaced a short-lived `/schichtplan-legacy` route).

### 2026-03-24
- Added canonical host + HTTPS 301 rules: `ordio.com` → `https://www.ordio.com`; `http://www.ordio.com` → `https://www.ordio.com` (see section above)

### 2026-03-20
- Removed Lexikon placeholder redirect: `/insights/lexikon/nachweisgesetz/` → `/insights/lexikon/taetigkeitsnachweis/` (canonical post now `nachweisgesetz`)
- Removed legacy redirect: `/insights/lexikon/mobiles-arbeiten/` → `/insights/lexikon/remote-work/` — canonical Lexikon post now `mobiles-arbeiten` (dedicated article; differentiation from Remote Work)

### 2026-03-18
- Added partner redirects: `/partnerprogramm`, `/partner-program` → `/partner` (301, QSA)

### 2026-03-17
- Added Lexikon pagination redirect: `/insights/lexikon/page/*` → `/insights/lexikon/`

### 2026-01-20
- Initial implementation of redirect rules
- Added redirects for `/lp`, `/lpp`, `/lpp-gastronomie`, `/l`, `/l2`, `/l3`, `/ad`
- Implemented parameter mapping (`h1` → `title`)
- Added query string preservation using `QSA` flag
- Created test script for validation
- Added comprehensive documentation
