2017-10-21 85 views
1

GET重定向我正在做一个POST关闭以http://www.example.com/submit-bug用户生成的错误报告约40 C#桌面应用程序。如何停止单个URL POST更换成在.htaccess

不过我最近打开我的网站(其中POST数据处理)到HTTPS所以一切现在通过htaccess的301'ed到HTTPS。

这也意味着,我的POST到http://www.example.com/submit-bug被301'ed到https://www.example.com/submit-bug这会导致它从POST去一个GET重定向中失去了所有的POST数据。

如何告诉htaccess忽略重定向到http://www.example.com/submit-bug的帖子,并继续执行Laravel使用的正常index.php路由。

我已经试过各种L和P标志的组合,但他们忽略或导致四百零四分之五百错误。

这是我目前的htaccess

RewriteEngine On 

#RewriteCond %{REQUEST_URI} (.*)submit-bug(.*) 
#RewriteRule^index.php [L] 

RewriteCond %{HTTPS} off 

# First rewrite to HTTPS: 
# Don't put www. here. If it is already there it will be included, if not 
# the subsequent rule will catch it. 

RewriteRule .* https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301] 
# Now, rewrite any request to the wrong domain to use www. 
# [NC] is a case-insensitive match 

RewriteCond %{HTTP_HOST} !^www\. [NC] 

RewriteRule .* https://www.%{HTTP_HOST}%{REQUEST_URI} [L,R=301] 

# Redirect Trailing Slashes If Not A Folder... 
RewriteCond %{REQUEST_FILENAME} !-d 
RewriteRule ^(.*)/$ /$1 [L,R=301] 

# Handle Front Controller... 
RewriteCond %{REQUEST_FILENAME} !-d 
RewriteCond %{REQUEST_FILENAME} !-f 
RewriteRule^index.php [L] 

# Handle Authorization Header 
RewriteCond %{HTTP:Authorization} . 
RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}] 

回答

1

您可以删除任何重定向或重写关于POST,加入之初,RewriteCond %{HTTPS} off前:

RewriteCond %{REQUEST_METHOD} POST 
RewriteRule^- [L] 
+1

好极了!所以,我需要的到底是\t 的RewriteCond%{REQUEST_METHOD} POST 重写规则^的index.php [L] 赏金授予我的朋友:-) – jamie

+0

谢谢! ;-) – Croises