Page 1 of 1

Forms not working after adding .htaccess rule

Posted: Tue Jun 25, 2019 12:34 am
by kevindef
Hello there,

Just wanted to check if anyone else have experienced the same issue of forms not working soon after adding the code to hide .html and .php page extensions inside the .htaccess file?

Not sure if there's a correlation between the two; .htaccess rule scrip and the contact forms behaviour. Inside the form; " use built-in PHP from processor script" was selected. The code hid the page extensions with no other issues other than the forms not working.

Any reasons, ideas, tips, hints, suggestions are all welcome.

Here's the code:

RewriteEngine On
RewriteCond %{HTTP_HOST} labourhub\.com\.au [NC]
RewriteCond %{SERVER_PORT} 80
RewriteRule ^(.*)$ https://labourhub.com.au/$1 [R,L]

RewriteEngine On
RewriteCond %{THE_REQUEST} /([^.]+)\.php [NC]
RewriteRule ^ /%1 [NC,L,R]

RewriteEngine On
RewriteCond %{REQUEST_FILENAME}.php -f
RewriteRule ^ %{REQUEST_URI}.php [NC,L]

RewriteEngine On
RewriteCond %{THE_REQUEST} /([^.]+)\.html [NC]
RewriteRule ^ /%1 [NC,L,R]

RewriteEngine On
RewriteCond %{REQUEST_FILENAME}.html -f
RewriteRule ^ %{REQUEST_URI}.html [NC,L]

Re: Forms not working after adding .htaccess rule

Posted: Tue Jun 25, 2019 5:43 am
by Pablo
Maybe the code causes the server to no longer process the PHP script?

Re: Forms not working after adding .htaccess rule

Posted: Tue Jun 25, 2019 8:32 am
by kevindef
Mmmm....in that case I might add a .htaccess skip rule for POST requests to allow forms submitted and give it a try.

Thanks Pablo, let me see how that goes.