2017-10-21 83 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