dongshengyin0147 2015-02-28 09:48
浏览 63

强制SSL服务器和子域崩溃

www.miinik.com - domain

www.jingjingna.com - subdomain

I have tried most of the htaccess code to force SSL, but it keep causing a redirect loop. So I got this code from the internet applied it through plugin, WOW! it is now working perfectly... for miinik.com. Sadly, I log into jingjingna.com and now all the setting from miinik.com applied it to jingjingna.com(it suppose to be a completely different site). The problem could be from the php code or htaccess(miinik.com) *PS I have not edit jingjingna htaccess

<?php
if (stripos(get_option('siteurl'), 'https://') === 0) {
    $_SERVER['HTTPS'] = 'on';

    // add JavaScript detection of page protocol, and pray!
    add_action('wp_print_scripts', 'force_ssl_url_scheme_script');
}

function force_ssl_url_scheme_script() {
?>
<script>
if (document.location.protocol != "https:") {
    document.location = document.URL.replace(/^http:/i, "https:");
}
</script>
<?php
}

---------------------miinik htaccess------------------------------

# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>
# END WordPress

</div>
  • 写回答

2条回答 默认 最新

  • douwo6738 2015-02-28 09:55
    关注
    RewriteEngine On
    RewriteCond %{HTTPS} !=on
    RewriteRule (.*) https://wwww.miinik.com%{REQUEST_URI} [R,L]
    
    RewriteEngine On
    RewriteCond %{HTTPS} !=on
    RewriteRule (.*) https://www.jingjingna.com%{REQUEST_URI} [R,L]
    

    Here you go, just have 2 different .htaccess files on the domains.

    评论

报告相同问题?

悬赏问题

  • ¥15 制裁名单20240508芯片厂商
  • ¥20 易康econgnition精度验证
  • ¥15 msix packaging tool打包问题
  • ¥28 微信小程序开发页面布局没问题,真机调试的时候页面布局就乱了
  • ¥15 python的qt5界面
  • ¥15 无线电能传输系统MATLAB仿真问题
  • ¥50 如何用脚本实现输入法的热键设置
  • ¥20 我想使用一些网络协议或者部分协议也行,主要想实现类似于traceroute的一定步长内的路由拓扑功能
  • ¥30 深度学习,前后端连接
  • ¥15 孟德尔随机化结果不一致