[英].htaccess redirect subdomain to ssl site
我想让我的网站http://subdomain.domain.com重定向到另一个外部SSL加密的域https://subdomain.external.com ,同时将原始地址保留在浏览栏中。 据我所知,使用CNAME可以很容易地做到这一点,但是问题是它无需SSL加密即可重定向到外部链接。
有人告诉我可以使用.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
您能帮我知道如何修改.htaccess文件以满足我的要求吗? 非常感谢你!
胡安
如果要使用PHP:
$redirect = "https://www.ssl.com".$_SERVER['REQUEST_URI'];
header("Location: $redirect");
exit;
然后,您必须通过.htaccess将所有请求路由到此PHP文件:
RewriteEngine on
RewriteRule ^([^.]+)$ index.php [QSA]
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.