嘿,我想使用的.htaccess来重定向请求的页面到同一个页面的其他领域,我希望它转发所有的POST数据而改变地址栏到新的领域,像一个正常的重定向。
Hey, I want to use .htaccess to redirect the requested page to the exact same page on a different domain, and I want it to forward all POST data while CHANGING the address bar to the new domain, like a normal redirect.
下面是我的code。
Options +FollowSymLinks RewriteEngine on RewriteRule (.*) www.domain1/$1 [R=301,L]
的问题是,POST数据不发送这种方式。然后我试图这样的:
The problem is that POST data is not sent this way. I then tried this:
Options +FollowSymLinks RewriteEngine on RewriteRule (.*) www.domain1/$1 [R=301,P]和的作品转发POST数据,但地址栏不更改为新domain1
And that works to forward POST data, however the address bar does not change to the new domain1
我怎样才能做到这一点?
How can I accomplish this?
谢谢!
推荐答案遗憾的是,HTTP协议不支持这一点。
Unfortunately, the HTTP protocol does not support this.
在执行你的第一个例子,Web服务器发送请求的浏览器中的位置头告诉浏览器导航到指定的URL。浏览器尝试加载这个新的URL像一个普通的网页,包括在浏览器的地址栏中显示的URL。
When executing your first example, the web server sends the requesting browser a "Location" header telling the browser to navigate to a specified URL. The browser attempts to load this new URL like an ordinary web page, including displaying the URL in the browser's address bar.
由于浏览器是系统加载新的URL,浏览器必须是系统重新POST提交的数据。 Web服务器不能做到这一点。遗憾的是,HTTP协议中没有提供一种方式为网络服务器可以告诉浏览器preform这个重新发布。
Since the browser is the system loading the new URL, the browser must be the system to re-POST the submitted data. The web server can't do it. Unfortunately, the HTTP protocol does not provide a way for the web server to tell the browser to preform this re-POSTing.
有另一种方式来实现自己的目标?
Is there an alternate way to achieve your goal?
更多推荐
的.htaccess转发到外部网站和转发POST数据而改变地址栏?
发布评论