Advertisement
sc0ttkclark

WP HTTPS tweaks for wp-config.php

Apr 26th, 2011
432
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 1.01 KB | None | 0 0
  1. <?php
  2. // wp-config.php
  3.  
  4. if(empty($_SERVER['HTTPS']))
  5. {
  6.     ob_start('my_fix_https_links');
  7.     function my_fix_https_links ($content)
  8.     {
  9.         $content = str_replace('https://' . $_SERVER['HTTP_HOST'], 'http://' . $_SERVER['HTTP_HOST'], $content);
  10.         return $content;
  11.     }
  12. }
  13. if(!empty($_SERVER['HTTPS']))
  14. {
  15.     define('WP_PLUGIN_URL', 'https://' . $_SERVER['HTTP_HOST'] . '/wp-content/plugins');
  16.     define('WP_CONTENT_URL', 'https://' . $_SERVER['HTTP_HOST'] . '/wp-content');
  17.     define('WP_SITEURL', 'https://' . $_SERVER['HTTP_HOST']);
  18.     define('WP_URL', 'https://' . $_SERVER['HTTP_HOST']);
  19.     define('WP_HOME', 'https://' . $_SERVER['HTTP_HOST']);
  20. }
  21. else
  22. {
  23.     define('WP_PLUGIN_URL', 'http://'.$_SERVER['HTTP_HOST'].'/wp-content/plugins');
  24.     define('WP_CONTENT_URL', 'http://'.$_SERVER['HTTP_HOST'].'/wp-content');
  25.     define('WP_SITEURL', 'http://'.$_SERVER['HTTP_HOST']);
  26.     define('WP_URL', 'http://'.$_SERVER['HTTP_HOST']);
  27.     define('WP_HOME', 'http://'.$_SERVER['HTTP_HOST']);
  28. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement