Forum Replies Created

Viewing 4 replies - 1 through 4 (of 4 total)
  • Place the following code into your functions.php:

    add_filter( 'redirect_canonical', function ( $redirect_url = '', $requested_url = '' ) {
        if ( preg_match( '/^http:\/\//', $redirect_url ) ) {
            $redirect_url = preg_replace( '/^http:\/\//', 'https://', $redirect_url );
        }
    
        return $redirect_url;
    }, 10, 2 );

    This will check all redirect url’s on having https:// instead of https://, fixing them as it goes.

    • This reply was modified 3 years, 5 months ago by Mike Madern.

    Hi @dcavins,

    The first thing I checked ?? worth to be noticed that the URL’s had indeed a https:// prefix and we changed it to have https://.
    The problem still existed after we updated the settings.

    After that we did a Search and Replace, checked the .htaccess for unusual configuration, ran a check on configured redirects, reactivated the plugins.
    But no results so far.

    -M

    Hi @dcavins,

    I used httpstatus.io to figure out the redirects.

    
    Status Code, Scheme,    Host,                                 Path
    301,         https://,  extranet.leefbaarheidsteamermelo.nl,  /wp-content/uploads/bp-attachments/1753/Notulen-12-januari-2021.docx
    301,         https://,   extranet.leefbaarheidsteamermelo.nl,  /?p=1753&bp-attachment=Notulen-12-januari-2021.docx
    301,         https://,  extranet.leefbaarheidsteamermelo.nl,  /?p=1753&bp-attachment=Notulen-12-januari-2021.docx
    302,         https://,  extranet.leefbaarheidsteamermelo.nl,  /documenten/notulen-dinsdag-12-januari/?bp-attachment=Notulen-12-januari-2021.docx
    200,         https://,  extranet.leefbaarheidsteamermelo.nl,  /wp-login.php?redirect_to=https%3A%2F%2Fextranet.leefbaarheidsteamermelo.nl%2Fdocumenten%2Fnotulen-dinsdag-12-januari%2F%3Fbp-attachment%3DNotulen-12-januari-2021.docx
    

    The first redirect, to ?p=%d&bp-attachment=%s is the one to HTTP.

    – Edit
    Good to let you know that when attachments are not private, the problem is not there.

    – Mike

    • This reply was modified 4 years, 1 month ago by Mike Madern.

    We encoutered the same issue.
    Somewhere in the process the URL is redirected a couple of times.

    We solved the problem (for now) by editing /wp-content/plugins/buddypress-docs/includes/templatetags.php:2203

    We fixed the attachment URL:

    $markup = sprintf(
    			'<li id="doc-attachment-%d"><span class="doc-attachment-mime-icon doc-attachment-mime-%s"></span><a href="%s" title="%s">%s</a>%s</li>',
    			$attachment_id,
    			$attachment_ext,
    			
    			// $att_url,
    			sprintf( "%s?bp-attachment=%s", $doc_url, $att_base ),
    			
    			esc_attr( $att_base ),
    			esc_html( $att_base ),
    			$attachment_delete_html
    		);

    I know this is not the correct way to do it, but we needed it to work quickly.
    Please update the plugin.

Viewing 4 replies - 1 through 4 (of 4 total)