Make WordPress Core

Opened 10 years ago

Closed 9 years ago

#33131 closed defect (bug) (invalid)

Missing trailing slash when ssl cookie is set

Reported by: m1au's profile m1au Owned by:
Milestone: Priority: normal
Severity: normal Version: 4.2.3
Component: Login and Registration Keywords:
Focuses: Cc:

Description

Hi,

Im running wordpress on php commandline server, and can not use Rewrites, and it seems that there is an trailing slash missing when ssl cookie is set causing 404 on all links in admin section.

Non ssl seems to have trailing slash on wp-admin set

835
836                 if ( ( empty( $redirect_to ) || $redirect_to == 'wp-admin/' || $redirect_to == admin_url() ) ) {
837                         // If the user doesn't belong to a blog, send them to user admin. If the user can't edit posts, send them to their profile.
838                         if ( is_multisite() && !get_active_blog_for_user($user->ID) && !is_super_admin( $user->ID ) )
839                                 $redirect_to = user_admin_url();

whereas when ssl cookie is set there is no trailing slash added to wp-admin

784         if ( isset( $_REQUEST['redirect_to'] ) ) {
785                 $redirect_to = $_REQUEST['redirect_to'];
786                 // Redirect to https if user wants ssl
787                 if ( $secure_cookie && false !== strpos($redirect_to, 'wp-admin') )
788                         $redirect_to = preg_replace('|^http://|', 'https://', $redirect_to);
789         } else {
790                 $redirect_to = admin_url();
791         }

Change History (1)

#1 @johnbillion
9 years ago

  • Milestone Awaiting Review deleted
  • Resolution set to invalid
  • Status changed from new to closed

Thanks for the report, m1au. Sorry you didn't get a response sooner.

The code in question (in wp-login.php) only handles the redirect location after a user logs in. It doesn't affect how rewrite rules behave. Additionally, rewrite rules aren't used for admin area URLs unless you're running Multisite.

The lack of a trailing slash here is so that any value of $_REQUEST['redirect_to'] that contains wp-admin gets matched, and the scheme of the redirect gets set to https.

If you're having problems with rewrite rules I would recommend opening a support forum thread with some more details of your site's configuration and exactly what problem you're seeing.

Note: See TracTickets for help on using tickets.