Title: [Plugin: Subscribe2] Feature request: base url
Last modified: August 20, 2016

---

# [Plugin: Subscribe2] Feature request: base url

 *  [belg4mit](https://wordpress.org/support/users/belg4mit/)
 * (@belg4mit)
 * [14 years, 1 month ago](https://wordpress.org/support/topic/plugin-subscribe2-feature-request-base-url/)
 * It would be useful if there were a setting to set the base url of links to include
   in messages so that one could control whether the URL was with or without www,
   or https vs. http, etc. In our case, the public does not use the HTTP only site,
   and this would provide some separation of tracking in access logs.
 * [http://wordpress.org/extend/plugins/subscribe2/](http://wordpress.org/extend/plugins/subscribe2/)

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

 *  [Matt Robinson](https://wordpress.org/support/users/mattyrob/)
 * (@mattyrob)
 * [14 years, 1 month ago](https://wordpress.org/support/topic/plugin-subscribe2-feature-request-base-url/#post-2719467)
 * [@belg4mit](https://wordpress.org/support/users/belg4mit/),
 * I don’t think I understand fully what you are asking for here. Is you site only
   accessible via https? If so this can be handled in the WordPress configuration
   and with entries in .htaccess can’t it?
 * Or is some of your content protected? And if that’s the case how can Subscribe2
   detect what’s secure and what’s not in order to produce the correct links?
 *  Thread Starter [belg4mit](https://wordpress.org/support/users/belg4mit/)
 * (@belg4mit)
 * [14 years, 1 month ago](https://wordpress.org/support/topic/plugin-subscribe2-feature-request-base-url/#post-2719558)
 * >Is you site only accessible via https?
    No it’s accessible via both, but as 
   I said, different groups use HTTP and HTTPS.
 * >And if that’s the case how can Subscribe2 detect what’s
    >secure and what’s 
   not in order to produce the correct links? It doesn’t have to. The users that
   get the updates only use HTTPS.
 * Details were omitted for simplicity/clarity but apparently the
    general case 
   is insufficient. The public uses HTTP and does not subscribe. Staff use HTTPS
   and are subscribed. We would like for the updates to use HTTPS URLs so that staff
   traffic remains segregated from the public’s.
 *  [Matt Robinson](https://wordpress.org/support/users/mattyrob/)
 * (@mattyrob)
 * [14 years, 1 month ago](https://wordpress.org/support/topic/plugin-subscribe2-feature-request-base-url/#post-2719562)
 * [@belg4mit](https://wordpress.org/support/users/belg4mit/),
 * Right, now I understand what you mean. That’s not an easy fix really, certainly
   not within the current code.
 * One possible way, if you are interested, would be to use on of Subscribe2’s filters
   that contains the email body content, take this as input and replace all instances
   of http:// with https:// before returning the ‘corrected’ body content.
 * Would that work for you?
 *  Thread Starter [belg4mit](https://wordpress.org/support/users/belg4mit/)
 * (@belg4mit)
 * [14 years ago](https://wordpress.org/support/topic/plugin-subscribe2-feature-request-base-url/#post-2719610)
 * Yes, that would work. What is the filter name? I don’t see anything in the FAQ,
   and nothing stands out when I grep the source code.
 *  [Matt Robinson](https://wordpress.org/support/users/mattyrob/)
 * (@mattyrob)
 * [14 years ago](https://wordpress.org/support/topic/plugin-subscribe2-feature-request-base-url/#post-2719611)
 * [@belg4mit](https://wordpress.org/support/users/belg4mit/),
 * If you grep for “apply_filters(” you’ll find all the lines where I’ve got filters
   but I think you’ll need ‘s2_html_email’ and ‘s2_plain_email’ which are both in
   the header() function in the class-s2-core.php file.
 * In both cases the first parameter passed is the content of the email so you can
   then str_replace(“[http://&#8221](http://&#8221);, “[https://&#8221](https://&#8221);,
   $message);
 *  Thread Starter [belg4mit](https://wordpress.org/support/users/belg4mit/)
 * (@belg4mit)
 * [14 years ago](https://wordpress.org/support/topic/plugin-subscribe2-feature-request-base-url/#post-2719636)
 * I used:
 *     ```
       #https digest links to separate access log entries
       function rebase_digest($message){
         return str_replace("http://", "https://", $message);
       }
       add_filter('s2_plain_email', 'rebase_digest');
       add_filter('s2_html_email', 'rebase_digest');
       ```
   
 * It works fine for the test sent from the settings page,
    but seems to cause failure
   of delivery for the actual message (digest) :-/
 *  [Matt Robinson](https://wordpress.org/support/users/mattyrob/)
 * (@mattyrob)
 * [14 years ago](https://wordpress.org/support/topic/plugin-subscribe2-feature-request-base-url/#post-2719638)
 * [@belg4mit](https://wordpress.org/support/users/belg4mit/),
 * For digest emails you need to use a different hook. Try hooking you function 
   to ‘s2_digest_email’.
 *  Thread Starter [belg4mit](https://wordpress.org/support/users/belg4mit/)
 * (@belg4mit)
 * [14 years ago](https://wordpress.org/support/topic/plugin-subscribe2-feature-request-base-url/#post-2719639)
 * I’m not sure why that should allow the preview message to work okay but cause
   the normal delivery to fail, however I’ll try it, thanks.

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

The topic ‘[Plugin: Subscribe2] Feature request: base url’ is closed to new replies.

 * ![](https://ps.w.org/subscribe2/assets/icon-256x256.png?rev=2318630)
 * [Subscribe2 - Form, Email Subscribers & Newsletters](https://wordpress.org/plugins/subscribe2/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/subscribe2/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/subscribe2/)
 * [Active Topics](https://wordpress.org/support/plugin/subscribe2/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/subscribe2/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/subscribe2/reviews/)

 * 8 replies
 * 2 participants
 * Last reply from: [belg4mit](https://wordpress.org/support/users/belg4mit/)
 * Last activity: [14 years ago](https://wordpress.org/support/topic/plugin-subscribe2-feature-request-base-url/#post-2719639)
 * Status: not resolved