子域名重定向请求子目录+ HTTPS(使用的.htaccess)子目录、重定向、域名、htaccess

2023-09-02 09:38:17 作者:如果他不忠你还爱吗

我有一个的.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}