Skip to main content

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

FormatColumn HeadersDescription
genericfrom,to,typeDefault simple format
seopresssource_url,target_url,redirect_typeSEOPress export
yoasturl,type,targetYoast SEO export
rankmathsource_url,redirect_to,redirect_typeRank 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

CodeMeaning
0Success (all rows imported)
1Some rows had errors
2Usage error
4WordPress path not configured