Make WordPress Core

Opened 7 years ago

Closed 5 years ago

#6298 closed defect (bug) (duplicate)

Canonical redirect broken on static front page

Reported by: Denis-de-Bernardy Owned by:
Milestone: Priority: normal
Severity: major Version: 2.5
Component: Optimization Keywords:
Focuses: Cc:


Create a static page, 'Test', publish and browse the page.

In a separate window, browse settings / reading, set this page as the static front page.

Return to the initial window, refresh.

Behavior produced: WP displays the page as it normally would.

Expected behavior: WP redirects to get_option('home');

Change History (7)

comment:1 @Denis-de-Bernardy7 years ago


		if ( is_front_page() )
			$home_url = get_option('home');
			$home_path = parse_url($home_url);
			$home_path = $home_path['path'];
			if ( rtrim($_SERVER['REQUEST_URI'], '/') != rtrim($home_path, '/') )
				header('HTTP/1.1 301 Moved Permanently');
				header('Status: 301 Moved Permanently');
				#var_dump(rtrim($_SERVER['REQUEST_URI'], '/'), rtrim($home_path, '/'));

comment:2 @lloydbudd7 years ago

  • Owner changed from anonymous to markjaquith

comment:3 @Denis-de-Bernardy7 years ago

the above code has a tiny bug: the is_paged() case also needs to be processed.


comment:4 @Denis-de-Bernardy6 years ago

  • Owner changed from markjaquith to Denis-de-Bernardy
  • Status changed from new to accepted

comment:5 @Denis-de-Bernardy6 years ago

  • Owner Denis-de-Bernardy deleted
  • Status changed from accepted to assigned

comment:6 @markjaquith6 years ago

  • Milestone changed from 2.9 to 3.0

comment:7 @dd325 years ago

  • Milestone 3.0 deleted
  • Resolution set to duplicate
  • Status changed from assigned to closed

See #11991

Note: See TracTickets for help on using tickets.