Make WordPress Core

Opened 17 years ago

Closed 16 years ago

Last modified 15 years ago

#7173 closed enhancement (fixed)

Improve SEO by redirecting "index.php"

Reported by: viper007bond's profile Viper007Bond Owned by: markjaquith's profile markjaquith
Milestone: 2.7 Priority: normal
Severity: normal Version: 2.6
Component: General Keywords: needs-patch
Focuses: Cc:

Description

If pretty permalinks are enabled, it can be assumed that http://site.com/index.php isn't needed. Therefore we should redirect all index.php requests to the home URL to avoid duplicate content issues. Plus it just looks better.

This should of course have an internal filter or something for those running crazy setups.

I've stuck this in my wp-config.php, but it'd nice to have it in the core. :)

if( $_SERVER[ 'REQUEST_URI' ] == '/index.php' ) {
	header( 'Location: http://www.mysite.com/', 301 );
	exit();
}

Change History (6)

#1 @Viper007Bond
17 years ago

  • Type changed from defect to enhancement

#2 @markjaquith
17 years ago

  • Owner changed from anonymous to markjaquith
  • Status changed from new to assigned

This was in canonical.php, but a certain setup was having issues (it reported /index.php even when viewing /, causing infinite redirects), so I rolled it back. The host in question was notified. We can fix this for 2.7 -- at the beginning of the cycle.

#4 @markjaquith
16 years ago

  • Milestone changed from 2.7 to 2.8

See also #5017 for original issue.

#5 @markjaquith
16 years ago

  • Resolution set to fixed
  • Status changed from assigned to closed

(In [9203]) Strip trailing /index.php in Canonical, fixes #5017. fixes #7173.

#6 @westi
16 years ago

  • Milestone changed from 2.8 to 2.7
Note: See TracTickets for help on using tickets.