Thread tagged as: Problem, Forms

Forms stop working when .php extension redirected to non .php


I am using this in the .htaccess file (amongst other entries)

# browser requests PHP redirect to non .php RewriteCond %{THE_REQUEST} ^[A-Z]{3,9}\ /([^\ ]+)\.php RewriteRule ^/?(.*)\.php$ /$1 [L,R=301]

However, as a result forms (using the Forms App) are no longer getting submitted or stored.

I remove those lines and everything works fine.

I am using the the rules to redirect pages being directly requested with .php to non .php for SEO purposes as my site audit flags duplicate content because it is seeing both .php and non .php as 2 different pages.

Any suggestions?

Neil Duddridge

Neil Duddridge 1 points

  • 4 years ago
Drew McLellan

Drew McLellan 2638 points
Perch Support

The form is being submitted, you're just throwing the data away when you redirect.

The solution would be to submit the form to the URL you want it to go to without a redirect.

Ok, I see what you're saying.