M
M
Minusator2019-01-19 07:23:37
htaccess
Minusator, 2019-01-19 07:23:37

How to remove .php extensions so that POST requests to a php file work correctly?

Good!
I removed extensions from files via htaccess .php, but there is a php file that gives a 301 response when a POST request is made.

RewriteEngine On
RewriteCond %{THE_REQUEST} ^[A-Z]{3,9}\ /([^\ ]+)\.php
RewriteRule ^/?(.*)\.php$ /$1 [L,R=301]
RewriteCond %{REQUEST_FILENAME}\.php -f
RewriteRule ^/?(.*)$ /$1.php [L]

5c42a60440d23961169645.png
Maybe you can make a .php trim exception for site.ru/process/process.php?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
M
Minusator, 2019-01-19
@Minusator

I solved the issue by replacing in htaccess

RewriteEngine On
RewriteRule ^(([^/]+/)*[^.]+)$ /$1.php [L]

Now there is no extension, and the form works correctly

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question