我可以从子改写到文件夹重定向避免? [英] Can I rewrite from subdomain to folder avoiding redirection?

查看:149
本文介绍了我可以从子改写到文件夹重定向避免?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我希望我的子域名直接指向一个文件夹。
也就是说,如果一个HTTP请求到apple.example.com制作,
我想响应成为example.com/apple/index.html的内容,而不是301出错。
这可能吗?

I want my subdomain to point directly to a folder. That is if an HTTP request is made to apple.example.com, I want the response to be the contents of example.com/apple/index.html, but not a 301 error. Is it possible?

推荐答案

您可以从任何文件夹为内容提供服务,也可以发送重定向到客户端,但据我所知,你不能在同一时间两者都做的 - 你不能提供内容和在某种程度上改变浏览器的URL在同一时间。

You can serve content from any folder or you can send a redirect to the client, but AFAIK you cannot do both at the same time - you cannot serve content and somehow change the url in browser at the same time.

如果有可能,它都肯定会导致许多安全隐患。

If it would be possible, it would most definitely lead to many security exploits.

这篇关于我可以从子改写到文件夹重定向避免?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆