Console Commands
All commands are available via ddev php craft (or php craft outside DDEV).
Export and import commands support stdin and stdout for piping. This makes them useful for scripting, CI/CD pipelines, and AI agent workflows:
# Pipe 404 export to another tool
php craft not-found-redirects/not-found-uris/export - --format=json | jq '.[] | select(.hitCount > 10)'
# Import from stdin
cat redirects.csv | php craft not-found-redirects/redirects/import - --format=csv404s
Export
Export all 404 records.
php craft not-found-redirects/not-found-uris/exportArguments
path: string- File path to write to, or `-` for stdout. Defaults to `-`.
Options
--format: csv|json- File format override. Inferred from file extension if omitted. Defaults to json for stdout.
Import
Import 404 records from a CSV or JSON file, or stdin.
php craft not-found-redirects/not-found-uris/importArguments
path: string- Path to the CSV or JSON import file. Use `-` to read from stdin.
Options
--format: csv|json- File format override. Auto-detected from file extension or content if omitted.
--source: native|retour- Data source. Auto-detected from column headers if omitted.
Reprocess
Reprocess unhandled 404s against enabled redirect rules.
php craft not-found-redirects/not-found-uris/reprocessPurge
Purge stale 404 records older than the given threshold.
php craft not-found-redirects/not-found-uris/purgeArguments
lastSeen: string- Purge cutoff — any strtotime()-compatible value (e.g. "-90 days").
Reset Hit Counts
Reset hit counts to zero for all 404s and referrers.
php craft not-found-redirects/not-found-uris/reset-hit-countsRedirects
Export
Export all redirect rules.
php craft not-found-redirects/redirects/exportArguments
path: string- File path to write to, or `-` for stdout. Defaults to `-`.
Options
--format: csv|json- File format override. Inferred from file extension if omitted. Defaults to json for stdout.
Import
Import redirect rules from a CSV or JSON file, or stdin.
php craft not-found-redirects/redirects/importArguments
path: string- Path to the CSV or JSON import file. Use `-` to read from stdin.
Options
--format: csv|json- File format override. Auto-detected from file extension or content if omitted.
--source: native|retour- Data source. Auto-detected from column headers if omitted.
Retour Migration
Migrate All
Migrate both 404 stats and redirect rules from Retour's database tables.
php craft not-found-redirects/migrate/retourMigrate 404s
Migrate 404 stats from Retour's retour_stats table.
php craft not-found-redirects/migrate/retour-404sMigrate Redirects
Migrate static redirect rules from Retour.
php craft not-found-redirects/migrate/retour-redirects