简体   繁体   English

htaccess无效301重定向和POST数据丢失

[英]htaccess unwanter 301 redirect and POST data loss

I have an MVC PHP application and in xampp works great, but in linux hosting is not working properly and when it comes to send POST data via form the htaccess (without any order) gives a 301 redirect and the POST data is lost forever... 我有一个MVC PHP应用程序,并且在xampp中运行良好,但是在linux主机中无法正常工作,当通过htaccess形式发送POST数据时(无任何顺序)会给出301重定向,并且POST数据将永远丢失。 。

here is my htaccess: 这是我的htaccess:

Options -MultiViews
RewriteEngine On

RewriteBase /devel

RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-l


RewriteRule ^(.+)$ index.php?url=$1 [QSA,L]

With browser i can see that there is a 301 for post data and 200 (ok) for get data... 使用浏览器,我可以看到有用于发布数据的301和用于获取数据的200(确定)...

please anyone knowr why i have this 301 redirect before the normal redirect? 请有人知道为什么我在正常重定向之前有此301重定向? In my script there is no header() function (not in the form nor in the destination page of course) and my hosting (Aruba.it) doens't have the mod_proxy enabled, so i can't use P flag for POST redirecting... 在我的脚本中没有header()函数(当然不在窗体中,也不在目标页面中),并且我的托管(Aruba.it)没有启用mod_proxy,因此我不能使用P标志进行POST重定向...

Ah i tried also 啊,我也试过了

RewriteCond %{REQUEST_METHOD} !POST

but without any result. 但没有任何结果。

Tank for any reply!!! 坦克的任何答复!!!

SOLVED 解决了

It came out it was a server redirect: i had a global var that contain the domain url "domain.com" to avoid writing it in my entire script. 结果是服务器重定向:我有一个包含域URL“ domain.com”的全局变量,以避免在整个脚本中编写它。 When it comes to call urls, the server auto rewrites "domain.com" in "www.domain.com" with a 301 http message. 当涉及到调用URL时,服务器会使用301 http消息自动重写“ www.domain.com”中的“ domain.com”。 I changed the value of the var and everything works fine now!!! 我更改了var的值,现在一切正常!

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

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