WordPress.org

Making WordPress.org


Ignore:
Timestamp:
01/18/2019 10:33:44 PM (11 months ago)
Author:
coffee2code
Message:

Plugin Directory: Add a 301 canonical URL redirect for wordpress.org/plugins to wordpress.org/plugins/.

See r6498.
Fixes #4062.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • sites/trunk/wordpress.org/public_html/wp-content/themes/pub/wporg-plugins/functions.php

    r8038 r8108  
    4343}
    4444add_action( 'after_setup_theme', __NAMESPACE__ . '\setup' );
     45
     46/**
     47 * Handle the root-level redirect to trailing-slash'd uri which redirect_canonical() usually does.
     48 */
     49function enforce_trailing_slash() {
     50    if ( '/plugins' === $_SERVER['REQUEST_URI'] ) {
     51        wp_safe_redirect( '/plugins/' );
     52        die();
     53    }
     54}
     55add_action( 'template_redirect', __NAMESPACE__ . '\enforce_trailing_slash' );
    4556
    4657/**
Note: See TracChangeset for help on using the changeset viewer.