使用Apache虚拟主机将子域重定向到HTTPS www url



我想知道如何重定向http&https到特定的URL。

我希望它来自:

http://test.example.com to https://www.example.com/test

https://test.example/com to https://www.example.com/test

希望这对我有用时会有所帮助。

在此处检查此.htaccess代码

RewriteEngine on
RewriteCond %{HTTP_HOST} ([a-z]+).(example.com) #checking domain and subdomain
RewriteRule ^(.*)$ https://www.%2/%1 [R=301,L] #redirecting

相关内容

最新更新