ARTICLE AD BOX
I have a WordPress website hosted on a server (Apache or Nginx). I am facing an issue where .php URLs (e.g., https://example.com/page/test.php) return a 404 error page from the hosting server, not the custom 404 page from WordPress.
I need to redirect or make sure WordPress properly handles .php-ended URLs as clean URLs without the .php extension, as WordPress typically uses clean URLs (e.g., https://example.com/page/).
Here are the solutions I've tried:
Using .htaccess to handle the redirection: I added the following .htaccess rule: RewriteEngine On RewriteCond %{REQUEST_URI} \.php$ RewriteRule ^(.*)\.php$ /$1 [R=301,L] But this caused a redirect loop and the page was not found.