Form Data lost

ISAPI_Rewrite is Apache mod_rewrite compatible URL rewriter for Microsoft IIS
User avatar
Posts: 9
Joined: 27 Mar 2012, 22:41

Form Data lost

27 Mar 2012, 22:47

This is my rewrite config file:
# Helicon ISAPI_Rewrite configuration file
# Version 3.1.0.87

RewriteEngine on

#This protects forms from losing data
RewriteCond %{REQUEST_METHOD} !^POST$ [NC]

#Redirect extension requests to avoid duplicate content
RewriteRule ^([^?]+)\/$ $1 [NC,R=301,L]

#Redirect extension requests to avoid duplicate content
RewriteRule ^([^?]+)\.html$ $1 [NC,R=301,L]

#Internally add extensions to request
RewriteCond %{REQUEST_FILENAME}.html -f
RewriteRule (.*) $1.html



I have a problem when a form is submitted, the data is still being lost.

Any suggestions.

Can I isolate the page from the rewrite ?
the page is /contact/emailer.html

Thanks

User avatar
Posts: 1264
Joined: 07 Mar 2012, 10:16

Re: Form Data lost

28 Mar 2012, 06:53

Hello,

You can't do both 301redirect and transfer data.
You need to add the following condition to the rule that applies. This will avoid losing data for POST forms.

Code: Select all
RewriteCond %{REQUEST_METHOD} !^POST$ [NC]


Regards
Andrew

User avatar
Posts: 9
Joined: 27 Mar 2012, 22:41

Re: Form Data lost

28 Mar 2012, 10:10

Hi Andrew.

What do you mean by "You need to add the following condition to the rule that applies" ?

I included my complete config file in the above post.

User avatar
Posts: 1264
Joined: 07 Mar 2012, 10:16

Re: Form Data lost

29 Mar 2012, 05:40

I do not know what rule you have failing, so basically you need to make the problematic rule look like:

e.g.
Code: Select all
RewriteCond %{REQUEST_METHOD} !^POST$ [NC]
RewriteRule ^([^?]+)\.html$ $1 [NC,R=301,L]


Regards
Andrew

User avatar
Posts: 9
Joined: 27 Mar 2012, 22:41

Re: Form Data lost

29 Mar 2012, 07:35

OK, got it thanks :)

All fixed.

User avatar
Posts: 1
Joined: 01 Dec 2014, 04:37

Re: Form Data lost

01 Dec 2014, 04:38

I examine your post, but i think that there should be more talk about the threat that have initial started, so that the reasonable amount of data'll be available for decision, However, Nice post to talk about, well i like this. Regards

Return to ISAPI_Rewrite 3.0

Who is online

Users browsing this forum: No registered users and 14 guests