Making WordPress.org

Changeset 8097


Ignore:
Timestamp:
01/18/2019 01:59:01 AM (6 years ago)
Author:
dd32
Message:

Theme Directory: Add a canonical redirect for /themes/index.php which no-one should ever access.

Fixes #4061.

File:
1 edited

Legend:

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

    r7968 r8097  
    3838function wporg_themes_trailing_slashes() {
    3939    if ( '/themes' === $_SERVER['REQUEST_URI'] ) {
    40         wp_safe_redirect( '/themes/' );
     40        wp_safe_redirect( '/themes/', 301 );
     41        die();
     42    }
     43
     44    if ( false !== stripos( $_SERVER['REQUEST_URI'], '/index.php' ) ) {
     45        $url = str_ireplace( '/index.php', '/', $_SERVER['REQUEST_URI'] );
     46        wp_safe_redirect( $url, 301 );
    4147        die();
    4248    }
Note: See TracChangeset for help on using the changeset viewer.