简体   繁体   English

读取Javascript中的请求标头

[英]Reading request headers in Javascript

I need to be able to read the request headers coming from a redirect from a naked domain: 我需要能够读取来自裸域重定向的请求标头:

http://mydomain.com

to

http://www.mydomain.com/index.html

I need index.html to be able to parse any original request path and queries , how can I do that? 我需要index.html才能解析任何原始请求pathqueries ,我该怎么做?

Eg 例如

From naked domain: http://mydomain.com/abc to http://www.mydomain.com/index.html and then index.html will get the abc path request. 从裸域: http://mydomain.com/abc : http://mydomain.com/abchttp://www.mydomain.com/index.html ,然后index.html将获得abc路径请求。

The question is how to be able to achieve this? 问题是如何能够实现这一目标?

A similar question: Using DNS to redirect to another URL with a path 一个类似的问题: 使用DNS重定向到带有路径的另一个URL

use document properties to check and reditect for others questions use navigator roperties 使用文档属性检查并重新确定其他问题使用导航器

Get referrer use = document.referrer or document.URL 获取引荐来源网址= document.referrerdocument.URL

Look : http://www.w3schools.com/jsref/dom_obj_document.asp 外观: http : //www.w3schools.com/jsref/dom_obj_document.asp

In apache the best solution is control that with .httaccess 在apache中,最好的解决方案是使用.httaccess进行控制

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM