is possible redirect user, based on http-header content-type
?
for example:
1)
an application trying load localhost/res/123/var/abc
, content-type
set to:
application/json
the server should return json-result application (which implemented).
2)
if normal web-browser visiting url localhost/res/123/var/abc
, content-type
set to:
text/html
in case server should redirect browser output webview (e.g. index_web.html
).
can realize without using php?
the content type not set @ request time, far aware. thus, need check if browser sending accept
header, describes server kinds of data accept (and display) without downloading it. browsers this. send following header string server (this obtained chrome):
accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
therefore, need check accept
header using condition:
rewritecond %{http:accept} text/html [nc] # then, add rewriterules here ...
this check see if text/html
contained in accept
header.
Comments
Post a Comment