Title: Undefined array key in canonical.php
Last modified: June 14, 2024

---

# Undefined array key in canonical.php

 *  Resolved [stylise](https://wordpress.org/support/users/stylise/)
 * (@stylise)
 * [1 year, 12 months ago](https://wordpress.org/support/topic/undefined-array-key-in-canonical-php/)
 * WP 6.5.4
   PHP 8.1.29301 Redirects 2.7.5
 * It appears that this plugin is triggering an error in canonical.php. Disabling
   this plugin causes this error to not trigger.
 * PHP Warning: Undefined array key “scheme” in /…/wp-includes/canonical.php on 
   line 751
   751: $redirect_url = $redirect[‘scheme’] . ‘://’ . $redirect[‘host’];
    -  This topic was modified 1 year, 12 months ago by [stylise](https://wordpress.org/support/users/stylise/).

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

 *  Plugin Author [Alexandru Tapuleasa](https://wordpress.org/support/users/talextech/)
 * (@talextech)
 * [1 year, 12 months ago](https://wordpress.org/support/topic/undefined-array-key-in-canonical-php/#post-17826517)
 * Hmm, I really can’t see why 301 Redirects would do that. I’m not contradicting
   you, I understand disabling it fixes the issue but there must be some extra factor.
   Have you tried disabling other plugins except for 301 Redirects to see if it 
   still happens or switching the theme? Maybe it’s something extra that I can set
   to reproduce the issue?
 *  Thread Starter [stylise](https://wordpress.org/support/users/stylise/)
 * (@stylise)
 * [1 year, 12 months ago](https://wordpress.org/support/topic/undefined-array-key-in-canonical-php/#post-17826648)
 * It’s one of four undefined array key errors that I’m tracking down after upgrading
   from PHP 7.4 to 8.1.
    -  This reply was modified 1 year, 12 months ago by [stylise](https://wordpress.org/support/users/stylise/).
 *  Plugin Author [Alexandru Tapuleasa](https://wordpress.org/support/users/talextech/)
 * (@talextech)
 * [1 year, 12 months ago](https://wordpress.org/support/topic/undefined-array-key-in-canonical-php/#post-17826921)
 * I tested it with all versions between PHP 7.4 to 8.3 so it’s not that. Do you
   have any Custom URLs in your redirects that don’t have http/https in front maybe?
 *  Thread Starter [stylise](https://wordpress.org/support/users/stylise/)
 * (@stylise)
 * [1 year, 12 months ago](https://wordpress.org/support/topic/undefined-array-key-in-canonical-php/#post-17826928)
 * All of the redirects start with https. Could it possibly have something to do
   with .htaccess settings?
 *  Plugin Author [Alexandru Tapuleasa](https://wordpress.org/support/users/talextech/)
 * (@talextech)
 * [1 year, 12 months ago](https://wordpress.org/support/topic/undefined-array-key-in-canonical-php/#post-17827158)
 * I don’t see why … that error in redirect_canonical() seems to come up if it gets
   passed a URL without http /https scheme. It’s why I assumed something else is
   altering URLs like that.
 * And redirect_canonical gets called on most requests so if it was just 301 Redirects
   by itself we would have had a lot of reports about it very quickly.
 *  Thread Starter [stylise](https://wordpress.org/support/users/stylise/)
 * (@stylise)
 * [1 year, 11 months ago](https://wordpress.org/support/topic/undefined-array-key-in-canonical-php/#post-17834185)
 * I’m not sure why this keeps getting marked as resolved, unless the resolution
   is to uninstall the plugin.

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

The topic ‘Undefined array key in canonical.php’ is closed to new replies.

 * ![](https://ps.w.org/eps-301-redirects/assets/icon-256x256.png?rev=2413221)
 * [301 Redirects - Redirect Manager](https://wordpress.org/plugins/eps-301-redirects/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/eps-301-redirects/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/eps-301-redirects/)
 * [Active Topics](https://wordpress.org/support/plugin/eps-301-redirects/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/eps-301-redirects/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/eps-301-redirects/reviews/)

 * 6 replies
 * 2 participants
 * Last reply from: [stylise](https://wordpress.org/support/users/stylise/)
 * Last activity: [1 year, 11 months ago](https://wordpress.org/support/topic/undefined-array-key-in-canonical-php/#post-17834185)
 * Status: resolved