Making WordPress.org

Changeset 5211


Ignore:
Timestamp:
03/30/2017 07:25:52 PM (8 years ago)
Author:
Otto42
Message:

Plugin Directory: Handle redirects for clients that send the URL fragment back to the server after a redirect. Redirect such clients to the URL without the fragment. Fixes #2630.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • sites/trunk/wordpress.org/public_html/wp-content/plugins/plugin-directory/class-plugin-directory.php

    r5206 r5211  
    445445        add_rewrite_rule( '^([^/]+)/(installation|faq|screenshots|changelog|stats|developers|other_notes)/?$', 'index.php?redirect_plugin=$matches[1]&redirect_plugin_tab=$matches[2]', 'top' );
    446446
     447        // Handle redirects for broken clients that send #'s to the server
     448        add_rewrite_rule( '^([^/]+)/\#(installation|faq|screenshots|changelog|stats|developers|other_notes)/?$', 'index.php?redirect_plugin=$matches[1]', 'top' );
     449
    447450        // If changing capabilities around, uncomment this.
    448451        //Capabilities::add_roles();
     
    10161019        if ( get_query_var( 'redirect_plugin' ) && get_query_var( 'redirect_plugin_tab' ) ) {
    10171020            wp_safe_redirect( site_url( get_query_var( 'redirect_plugin' ) . '/#' . get_query_var( 'redirect_plugin_tab' ) ) );
     1021            die();
     1022        }
     1023   
     1024        // Handle a redirect for /$plugin/#$tab_name to just /$plugin/, because some clients don't like fragments in redirects
     1025        if ( get_query_var( 'redirect_plugin' ) ) {
     1026            wp_safe_redirect( site_url( get_query_var( 'redirect_plugin' ) . '/' ) );
    10181027            die();
    10191028        }
Note: See TracChangeset for help on using the changeset viewer.