Form Data Not Submitting – www vs non-www

ASP Functions

I recently upgraded my server. When I did, a standard form which submitted data suddenly stopped working. This server upgrade had involved going from Windows Server 2012 to Windows Server 2016. The versions of MySQL and PHP had updated. Just about everything which could update had updated.

I had no idea what aspect of this upgrade caused the form to stop working.

This form had been working before. Even so, I checked every single last detail in case the latest version of Windows was more picky than the last.

I made sure the form had a name. That every input field had a name.

That every data item needing quotes had quotes.

I tested the form with both GET and POST formats. Neither one gave even a single data field to the processing script. Both the GET and POST formats ended up entirely blank on the other side. No data at all was sent.

It was wholly and utterly baffling. No website search revealed any solution. Most pages simply talked about people forgetting the basics. Not having a name field. But my forms had worked before. It wasn’t something as simple as that.

Something had changed.

Finally I realized that my form destination was hard-coded with the full URL of the site, including an initial www. I had decided as part of my server move to simplify the default url to simply be ASPIsFun.com rather than www. ASPIsFun.com. That change involved creating an IIS server redirect.

You’d think that messages sent to the www.ASPIsFun.com with query components would be fully rerouted. But no – it appears that while the user is redirected to the new URL, all query data is lost along the way. Both GET and POST data was lost. It’s simply as if the form was never filled out.

The moment I changed my call to the form processing script to use the non-www version of the URL, everything started working again. No other change was needed.

So keep that in mind. If you change from www to non-www (or vice versa) any forms that pass data may stop working. You’ll need to update those forms to use the matching URL format so the data moves through properly again.

Note that if you have access to the IIS settings, you can change how that redirect is done. You can ensure the redirect preserves the query string parameters. I document that here:

Be the first to comment

Leave a Reply

Your email address will not be published.


*


This site uses Akismet to reduce spam. Learn how your comment data is processed.