Make WordPress Core

Opened 11 years ago

Closed 11 years ago

#25878 closed defect (bug) (worksforme)

wp_referer_field not includes base URL from general settings

Reported by: hectorlinares's profile hectorlinares Owned by:
Milestone: Priority: normal
Severity: normal Version:
Component: General Keywords:
Focuses: Cc:

Description

Im using the latest release version.

First you need to configure in general settings your wordpress url and website url to something like 'http://www.example.com/en/blog'.

Install some plugin with options panel.

Go to the plugin options panel and click in Save Settings.

You will be redirected to: http://www.example.com/wp-admin?... instead of http://www.example.com/en/blog/wp-admin?...

I have a solution, but i think its not the best one:

In wp_referer_field (wp-include/functions.php):
Change (line 1262):

$referer_field = '<input type="hidden" name="_wp_http_referer" value="' . esc_attr( wp_unslash( $_SERVER['REQUEST_URI'] ) ) . '" />'; 

Use:

$referer_field = '<input type="hidden" name="_wp_http_referer" value="'. site_url() . esc_attr( wp_unslash( $_SERVER['REQUEST_URI'] ) ) . '" />';

This solutions works fine, but uses absolute path instead of relative, attaching the full site url to the REQUEST_URI.

Change History (2)

#1 @dd32
11 years ago

$_SERVER['REQUEST_URI'] in your case should always be set to a full path, that is, /en/blog/wp-admin/.....

It sounds like the server has some kind of proxying setup which messes this up, or the request uri is only partially sent to PHP.. basically, I think the issue isn't WordPress, but your server configuration.

#2 @nacin
11 years ago

  • Milestone Awaiting Review deleted
  • Resolution set to worksforme
  • Status changed from new to closed
Note: See TracTickets for help on using tickets.