Apache重定向到子域

时间:2013-01-05 15:34:09

标签: apache url-rewriting webserver

到目前为止,我的网站网址是按照此模式https://www.xyz.com,我从中提供静态和动态内容。 https://www.xyz.com默认为主页https://www.xyz.com/static/index.html,动态内容由https://www.xyz.com/dyna/login.jsp提供。

最近我添加了一个额外的网络服务器并注册了子域名,我计划通过http URL方案而不是https来提供静态内容,并且仅从https URL提供动态页面。因此,如果用户输入https://www.xyz.com,则应重定向到http://static.abc.com

网络服务器:Apache 2.x

我的查询是:

一个。如何配置apache以将 https ://www.xyz.com上的请求重定向到 http ://static.abc.com,同时确保向{{3}发出请求}没有被重定向? 这会有明显的性能开销吗?

湾如果从http重定向到https并从https页面启动http屏幕导致在这种情况下的任何安全警告? 请注意,我不打算将任何数据从http提交到https,反之亦然,它只是URL重定向或链接。

℃。如何使重定向可缓存?

1 个答案:

答案 0 :(得分:0)

使用.htaccess将https://www.example.com/static/index.html定义为https://www.example.com/index.html

Options +FollowSymLinks
RewriteEngine on
RewriteCond %{HTTP_HOST} ^domain/static/index.html [NC]
RewriteRule ^(.*)$ domain/index.html$1 [L,R=301]
相关问题