htaccess unwanter 301重定向和POST数据丢失

时间:2023-02-03 11:11:14

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托管不能正常工作,当涉及通过表单发送POST数据htaccess(没有任何顺序)给出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(ok)...

please anyone knowr why i have this 301 redirect before the normal redirect? 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...

请任何人知道为什么我在正常重定向之前有这个301重定向?在我的脚本中没有header()函数(当然不在表单中,也不在目标页面中)和我的托管(Aruba.it)没有启用mod_proxy,所以我不能使用P标志进行POST重定向...

Ah i tried also

啊我也试过了

RewriteCond %{REQUEST_METHOD} !POST

but without any result.

但没有任何结果。

Tank for any reply!!!

任何回复坦克!

1 个解决方案

#1


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. When it comes to call urls, the server auto rewrites "domain.com" in "www.domain.com" with a 301 http message. I changed the value of the var and everything works fine now!!!

它出来是一个服务器重定向:我有一个全局var包含域url“domain.com”,以避免在我的整个脚本中写它。当涉及到呼叫网址时,服务器会自动使用301 http消息重写“www.domain.com”中的“domain.com”。我改变了var的值,现在一切正常!!!

#1


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. When it comes to call urls, the server auto rewrites "domain.com" in "www.domain.com" with a 301 http message. I changed the value of the var and everything works fine now!!!

它出来是一个服务器重定向:我有一个全局var包含域url“domain.com”,以避免在我的整个脚本中写它。当涉及到呼叫网址时,服务器会自动使用301 http消息重写“www.domain.com”中的“domain.com”。我改变了var的值,现在一切正常!!!