【发布时间】:2013-04-30 02:48:22
【问题描述】:
是否可以根据 HTTP-Header content-type 重定向用户?
例如:
1)
一个应用程序正在尝试加载localhost/res/123/var/abc,而content-type 设置为:
application/json
服务器应该只将 JSON-Result 返回给应用程序(已实现)。
2)
如果普通的网络浏览器正在访问 url localhost/res/123/var/abc,则 content-type 设置为:
text/html
在这种情况下,服务器应重定向浏览器以输出 web 视图(例如 index_web.html)。
我可以不使用 PHP 来实现这样的事情吗?
【问题讨论】:
标签: json apache .htaccess mod-rewrite content-type