0

This is my current rewrite rule for accessing php files without extension.

RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME}\.php -f
RewriteRule ^(.*?)/?$ $1.php [L]

However, I want to be able to format a URL like so,

https://example.com/somefile/parameter

So, something like,

https://example.com/check_user/12345

However I get 500 Internal Server Error when there is trailing parameter after the slash(/).

I really want to get to the bottom of this rewrite rule, and conquer it, but I simply don't have the time to do so. (Pressed for production.)

I would really appreciate the help.

deeJ
  • 361
  • 4
  • 13
  • I don't have any other rules except for 404 redirect rule. The example URL: https://example.com/somefile/parameter will cause the error. While https://example.com/somefile/ doesn't. somefile in this case is a php file, somefile.php – deeJ Jan 16 '18 at 20:55
  • btw, https://example.com/somefile.php/parameter works fine. – deeJ Jan 16 '18 at 21:02

1 Answers1

0

I seemed to have fixed it by using this.

RewriteCond %{REQUEST_FILENAME}.php -f
RewriteRule !.*\.php$ %{REQUEST_FILENAME}.php [QSA,L]

Got it here. Remove .php extension with .htaccess

deeJ
  • 361
  • 4
  • 13