Support » Plugin: BuddyPress Docs » htaccess Fileș in document directories redirect to http not https

Viewing 4 replies - 1 through 4 (of 4 total)
  • Thread Starter Andy Macaulay-Brook

    (@andymacb)

    I’ve found the filter hook bp_docs_attachments_generate_rewrite_rules and have adjusted the rewrite rules.

    However, there doesn’t seem to be an easy way to bulk regenerate the htaccess files. How would I get a document loop in my small fix plugin using your public function calls?

    Thanks.

    Plugin Author David Cavins

    (@dcavins)

    hi Andy,

    Obviously you’re digging in to this problem. Maybe you can help us resolve the http:// protocol issue. Do you know why your links were being generated as http://? We use get_permalink() to fetch the doc URL (and that uses home_url()), so why are yours http? Is your home or site url set to http? It’s a mystery; mine are always https.

    Regarding creating new htaccess, the simplest thing to do would be to loop through all non-public docs and save them. Then this action will be triggered in BP_Docs_Attachments:
    add_action( 'bp_docs_doc_saved', array( $this, 'check_privacy' ) );

    Thread Starter Andy Macaulay-Brook

    (@andymacb)

    It’s purely the htaccess file rewrite rule. I set up an empty directory with a couple of test files, accessed one using https and the redirect generated was http and not https.

    My fix on the site concerned is rather blunt. After a day without access to their documents, I was getting a bit frazzled. So my substitute rewrite rule uses https hardcoded and also the hostname. Something like:

    RewriteEngine On
    RewriteRule (.+) https://example.com/docs/my-doc-slug/?bp-attachment=$1 [R=302,NC]

    It would have been harder if you hadn’t put in the filter hook for the rewrite rules and passed the whole doc object!

    If the default htaccess rewrite rule is falling back to http then I can only think it’s something in my ISP’s configuration, but it seems to me that with more thought than I had left a rewrite rule that copies the schema and host from the request would do the trick?

    Plugin Author David Cavins

    (@dcavins)

    Can you see what value is returned by is_ssl() on your setup? What about for home_url() with no arguments?

Viewing 4 replies - 1 through 4 (of 4 total)
  • You must be logged in to reply to this topic.