Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/.htaccess/6.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
SSL通配符Apache_Apache_.htaccess_Ssl_Wildcard - Fatal编程技术网

SSL通配符Apache

SSL通配符Apache,apache,.htaccess,ssl,wildcard,Apache,.htaccess,Ssl,Wildcard,我有一个SAAS,其中我需要动态创建多个子域(注意:有很多子域,我不知道哪些子域将自动生成)。所以我不能对每一个都重复这一点: <VirtualHost *:80> ServerName a1.app.example.com Redirect / https://a1.app.example.com </VirtualHost> ServerName a1.app.example.com 重定向/https://a1.app.example.com

我有一个SAAS,其中我需要动态创建多个子域(注意:有很多子域,我不知道哪些子域将自动生成)。所以我不能对每一个都重复这一点:

<VirtualHost *:80>
    ServerName a1.app.example.com
    Redirect / https://a1.app.example.com
</VirtualHost>

ServerName a1.app.example.com
重定向/https://a1.app.example.com
有没有办法将http中的每个子域重定向到https?。类似于“重定向/https://*.app.example.com”


ServerName app.example.com
重定向/https://*.app.example.com
ServerName app.example.com
ServerAlias*.app.example.com
DirectoryIndex.php
DocumentRoot/var/www/xxxxxxx
斯伦金安
SSLCertificateFile/etc/ssl/xxxxx.crt
SSLCertificateKeyFile/etc/ssl/xxxx.key
SSLCertificateChainFile/etc/ssl/xxxx.crt

将其添加到主vhost中:

Options +FollowSymLinks -MultiViews
RewriteEngine On
RewriteCond %{HTTPS} off
RewriteRule ^(.*)$ https://%{HTTP_HOST}%{REQUEST_URI} [L,QSA,R=301]

并确保
mod_rewrite
处于活动状态。您可以使用
a2enmod rewrite
命令激活它。

您没有对我提供的答案提供任何输入。温柔地提醒您提供一些反馈/投票/接受,如果有帮助:-)
Options +FollowSymLinks -MultiViews
RewriteEngine On
RewriteCond %{HTTPS} off
RewriteRule ^(.*)$ https://%{HTTP_HOST}%{REQUEST_URI} [L,QSA,R=301]