redirection icon indicating copy to clipboard operation
redirection copied to clipboard

Nginx export of error rules

Open challet opened this issue 1 year ago • 1 comments

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

challet avatar Apr 23 '24 11:04 challet

There seems to be a related pending PR #2669

challet avatar Apr 23 '24 12:04 challet