Making WordPress.org

Changeset 9193


Ignore:
Timestamp:
10/16/2019 08:42:21 AM (5 years ago)
Author:
dd32
Message:

WordPress.org: Redirect searches to the global search.

Fixes #4288.
See #4282 for feed redirects.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • sites/trunk/wordpress.org/public_html/wp-content/mu-plugins/pub/wporg-canonical-tweaks.php

    r9191 r9193  
    2626
    2727/*
    28  * WordPress.org/feed/* should redirect to WordPress.org/news/feed/*
     28 * WordPress.org/-specific redirects
    2929 */
    30 if ( 'wordpress.org' === $_SERVER['HTTP_HOST'] && '/feed' === substr( $_SERVER['REQUEST_URI'], 0, 5 ) ) {
     30if ( 1 === get_current_blog_id() ) {
    3131    add_action( 'template_redirect', function() {
    3232        if ( is_feed() ) {
    33             wp_safe_redirect( '/news' . $_SERVER['REQUEST_URI'], 301 );
     33            // WordPress.org/feed/* should redirect to WordPress.org/news/feed/*
     34            wp_safe_redirect( '/news/feed/' . ( 'feed' !== get_query_var('feed') ? get_query_var('feed') : '' ), 301 );
     35            exit;
     36        } elseif ( is_search() ) {
     37            wp_safe_redirect( '/search/' . urlencode( get_query_var('s') ), 301 );
    3438            exit;
    3539        }
Note: See TracChangeset for help on using the changeset viewer.