子域名重定向请求子目录+ HTTPS(使用的.htaccess) [英] Redirect subdomain request to subdirectory + https (using .htaccess)

查看:716
本文介绍了子域名重定向请求子目录+ HTTPS(使用的.htaccess)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个的.htaccess 一些问题,我不能去上班。希望有人能解决这个问题的。

I've got some issues with a .htaccess that I just can't get to work. Hope someone could solve this one.

我对 www.域的的的的Apache 的服务器上的SSL证书。我想要的子域的指定列表上的所有 http://subdomain.domain.com 的请求重定向到的https: //www.domain.com/subdomain

I have a SSL certificate on the www.-domain on an Apache server. I want all http://subdomain.domain.com requests on a specified list of subdomains to redirect to https://www.domain.com/subdomain.

第二个问题是我没有的通配符证书的对非www的作品。请求,请求 https://subdomain.domain.com 将导致不可信连接警报。所以,这也有需要解决,但也许它需要另一种类型的重定向?

The second problem is I don't have a wildcard certificate that works on non-www. requests, requests to https://subdomain.domain.com will result in an "Untrusted Connection" alert. So this also has to be solved, but maybe it requires another type of redirect?

什么样的​​条件和规则可以使用达到这两个要求的.htaccess

What conditions and rules could achieve these two requirements using .htaccess?

推荐答案

试试这个规则:

RewriteCond %{HTTPS} off
RewriteCond %{HTTP_HOST} ^(specific|list|of|subdomains)\.example\.com$
RewriteRule ^ http://www.example.com/%1%{REQUEST_URI}

这篇关于子域名重定向请求子目录+ HTTPS(使用的.htaccess)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆