redirect import
Destructive
This command imports redirect rules. Use --dry-run to preview.
Usage
seo-ops redirect import <csv-file> [--path=<path>] [--dry-run] [--overwrite] [--format=generic|seopress|yoast|rankmath]
Import redirect rules from a CSV file. Supports multiple format presets and auto-detection.
Supported Formats
| Format | Column Headers | Description |
|---|---|---|
generic | from,to,type | Default simple format |
seopress | source_url,target_url,redirect_type | SEOPress export |
yoast | url,type,target | Yoast SEO export |
rankmath | source_url,redirect_to,redirect_type | Rank Math export |
Auto-detection matches column headers to the known formats.
Examples
# Import with auto-detect
seo-ops redirect import redirects.csv --path=/var/www/html --dry-run
# Force specific format
seo-ops redirect import redirects.csv --format=yoast --path=/var/www/html
# Overwrite existing redirects for duplicate source URLs
seo-ops redirect import redirects.csv --path=/var/www/html --overwrite
# Actually import (remove --dry-run)
seo-ops redirect import redirects.csv --path=/var/www/html
CSV Format (generic)
from,to,type
/old-page,/new-page,301
/expired,/new-location,302
Exit Codes
| Code | Meaning |
|---|---|
| 0 | Success (all rows imported) |
| 1 | Some rows had errors |
| 2 | Usage error |
| 4 | WordPress path not configured |