Skip to content

Nginx export of error rules #3850

@challet

Description

@challet

Summary

Exporting an action_type=error rule to an nginx format makes it a temporary redirection to nowhere

Actual Behavior

$ wp redirection export nginx file.json --format=json

{
    "id": 89,
    "url": "/410",
    "match_url": "/410",
    "match_data": {
        "source": {
            "flag_query": "pass",
            "flag_case": false,
            "flag_trailing": false,
            "flag_regex": false
        }
    },
    "action_code": 410,
    "action_type": "error",
    "action_data": null,
    "match_type": "url",
    "regex": false,
    [ ]
},

$ wp redirection export nginx file.conf --format=nginx

rewrite ^/410$  redirect;

Expected Behavior

location /410 {
  return 410;
}

Steps to reproduce

  1. Set up a rule to answer with an error (4xx or 5xx) : redirection rule
  2. Export it to an nginx file through wp redirection export cli command
  3. Make nginx to load it : it doesn't complain about the missing replacement arg but it seems to just ignore the rule

Environment

Wordpress 6.5.2, Redirection 5.4.2

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions