Title: PHP API Red_Item parameters update &#8211; something changed
Last modified: August 16, 2021

---

# PHP API Red_Item parameters update – something changed

 *  Resolved [MrSlartibartfast](https://wordpress.org/support/users/mrslartibartfast/)
 * (@mrslartibartfast)
 * [4 years, 9 months ago](https://wordpress.org/support/topic/php-api-red_item-parameters-update-something-changed/)
 * I’m using the plugin for a good while now, and we’re really happy with it.
    On
   the website I’m working on we have set up the creation of redirects with the 
   PHP Api, this worked fine until a month or so ago, but I can’t pin point the 
   exact time it stopped (I didn’t regularly update the plugin, we do have the latest
   version at the moment though).
 * I’m using Red_Item::create ( from the documentation [https://redirection.me/developer/php-api/](https://redirection.me/developer/php-api/))
   to set up 301 redirects, and at the moment the redirects created don’t work anymore.
   
   The change I see is that they are created with the following option selected:**
   Match**: “_URL and server_” If I’m updating this manually to “_URL only_” (and
   update the target url) it works.
 * So this is what we set up at the moment – it probably just needs some parameter
   to be updated I guess so the redirect is set to “URL only” from the start:
 *     ```
       $redirectData = array(
        'url' => $fromURL,
        'action_code' => 301,
        'action_data' => array('url' => $toURL),
        'action_type' => 'url',
        'match_type' => 'url',
        'match_data' => array(
          'source' => array(
             "flag_case" => true, 
             "flag_trailing" => true
          )
        ),
        'group_id' => 1
       );
   
       $result = @Red_Item::create($redirectData);
   
       //result processing follows
       ```
   
 * The vars $fromURL and $toURL contain the source and target url.
    -  This topic was modified 4 years, 9 months ago by [MrSlartibartfast](https://wordpress.org/support/users/mrslartibartfast/).

Viewing 2 replies - 1 through 2 (of 2 total)

 *  Plugin Author [John Godley](https://wordpress.org/support/users/johnny5/)
 * (@johnny5)
 * [4 years, 9 months ago](https://wordpress.org/support/topic/php-api-red_item-parameters-update-something-changed/#post-14773087)
 * Is the fromURL an absolute URL? If it is, and the domain or protocol is different
   to the current one, then it will be converted to URL and server match. If you
   remove the protocol and domain from the source URL then this will never happen.
 *  Thread Starter [MrSlartibartfast](https://wordpress.org/support/users/mrslartibartfast/)
 * (@mrslartibartfast)
 * [4 years, 9 months ago](https://wordpress.org/support/topic/php-api-red_item-parameters-update-something-changed/#post-14773652)
 * Thanks for your response.
    Yes looks like that is the issue – the fromURL is 
   an absolute URL and the URL to be redirected to is a relative path. Both on the
   same server, but I’ll remove the protocol and domain from the from URL since 
   its not needed actually.

Viewing 2 replies - 1 through 2 (of 2 total)

The topic ‘PHP API Red_Item parameters update – something changed’ is closed to 
new replies.

 * ![](https://ps.w.org/redirection/assets/icon-256x256.jpg?rev=983639)
 * [Redirection](https://wordpress.org/plugins/redirection/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/redirection/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/redirection/)
 * [Active Topics](https://wordpress.org/support/plugin/redirection/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/redirection/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/redirection/reviews/)

 * 2 replies
 * 2 participants
 * Last reply from: [MrSlartibartfast](https://wordpress.org/support/users/mrslartibartfast/)
 * Last activity: [4 years, 9 months ago](https://wordpress.org/support/topic/php-api-red_item-parameters-update-something-changed/#post-14773652)
 * Status: resolved