Support » Plugin: Redirection » Redirection New Update Breaks mod_rewrite Rules

  • Resolved lechon

    (@lechon)


    Hello,

    After updating to Redirection newest version Version 4.5 our mod_rewrite rules in place breaks the site. See error below:

    Fatal error: Uncaught ArgumentCountError: Too few arguments to function WordPress_Module::redirect_canonical(), 1 passed in public_html/wp-includes/class-wp-hook.php on line 290 and exactly 2 expected in public_html/wp-content/plugins/redirection/modules/wordpress.php:40 Stack trace: #0 public_html/wp-includes/class-wp-hook.php(290): WordPress_Module->redirect_canonical(‘https://www.dru…’) #1 public_html/wp-includes/plugin.php(206): WP_Hook->apply_filters(‘https://www.dru…’, Array) #2 public_html/wp-includes/canonical.php(597): apply_filters(‘redirect_canoni…’, ‘https://www.dru…’, ‘https://www.dru…’) #3 public_html/wp-includes/class-wp-hook.php(288): redirect_canonical(‘https://www.dru…’) #4 public_html/wp-includes/class-wp-hook.php(312): WP_Hook->apply_filters(NULL, Array) #5 public_html/wp-includes/plugin.php(478): WP_Hook->do_action(Array) #6 public_html/wp-includes/template-loader.p in public_html/wp-content/plugins/redirection/modules/wordpress.php on line 40

    There has been a critical error on your website.

    We disabled the mod_rewrite rules just to test and still broke the site when requesting an URL that does not exist but has a different permalink arrangement.

    For example:

    Sample URL
    https://www.mydomain/1477/my-cat

    Made up URL (this should return a 404 Not Found, instead breaks the site with the errors like the ones shown above:
    https://www.mydomain/dog/my-cat

    Disabling Redirection makes the mod_rewrite rules work again and also URLs that has a misconfigure permalink path return a 404 not found.

    We also have tested this on a site that has no Redirection rules from the plugin in place, still breaks the site when requesting wrong permalink structure.

    For your reference here is the mod_rewrite rules rules we are using:

    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_URI} !^/houses/
    RewriteCond %{REQUEST_URI} ^/([Houses\>\<_\s\+\ ]|%[A-Z0-9]{2,2})+/ [NC]
    RewriteRule ^[^/]+/(.*)$ houses/$1 [R=301,L,DPI,NC]
    #auto-correct errant characters from Houses URLs spaces and any encoded symobls
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_URI} ^[/]([houses\s>\+\ ]|%[A-Z0-9]{2,2}){6,} [NC]
    RewriteRule ^(.*)(?:[^a-zA-Z0-9/_-]|%[A-Z0-9]{2,2})+(.*)$ $1$2 [NC,L,R=301,DPI]

    We are using WordPress version 5.3 with Classic Editor. PHP Version 7.1.14

    Regards,

Viewing 13 replies - 1 through 13 (of 13 total)
  • Ashish Sharma

    (@ashish168527)

    @lechon exactly i’m also getting the same error on my site it may be due to the plugin update, please check the plugin and release the update as soon as possible,

    Thanks In Advance

    atoine

    (@atoine)

    I’m having the same issue as well…

    Plugin Author John Godley

    (@johnny5)

    It’s canonical redirects that were broken, not mod_rewrite, and sorry about that. I’ve added a fix and a unit test for this, as it’s something I wasn’t previously checking for.

    Can you replace modules/wordpress.php with the latest version here and see if that fixes the problem for you? If so I’ll release a .1 version for everyone.

    csorbamedia

    (@csorbamedia)

    Same problem on my websites.
    @johnny5 Replaced the file and at first look it seems working.

    csorbamedia

    (@csorbamedia)

    @johnny5 With the updated file it has been fixed. Please release a new update of the plugin.

    Thread Starter lechon

    (@lechon)

    @johnny5

    Replaced the file and broke front end. Message below

    Warning: Cannot modify header information – headers already sent by (output started at public_html/wp-content/plugins/redirection/modules/wordpress.php:1) in /public_html/wp-includes/pluggable.php on line 1265

    Warning: Cannot modify header information – headers already sent by (output started at /public_html/wp-content/plugins/redirection/modules/wordpress.php:1) in /public_html/wp-includes/pluggable.php on line 1268

    Plugin Author John Godley

    (@johnny5)

    @lechon that looks like you’ve maybe copy/pasted a space at the beginning of the file

    Thread Starter lechon

    (@lechon)

    @johnny5

    Let me check

    Thread Starter lechon

    (@lechon)

    @johnny5

    You are right!
    There was a space there.

    It now works!

    Thanks

    Plugin Author John Godley

    (@johnny5)

    Ok great, 4.5.1 released with the above fix. Thanks everyone, and again, my apologies. The new test will prevent this particular issue occuring in the future

    Thread Starter lechon

    (@lechon)

    @johnny5
    Thank you so much for fixing this so quick.

    cheers!

    jenseo

    (@jenseo)

    Thanks for the quick fix, a visitor just made us aware of the same problem. To confirm, the update took care of the problem.

    atoine

    (@atoine)

    4.5.1 is working, thanks for the quick turnaround!

Viewing 13 replies - 1 through 13 (of 13 total)
  • The topic ‘Redirection New Update Breaks mod_rewrite Rules’ is closed to new replies.