0

So basically, I have a rewrite rule, so if people write /xyz12 it works as serve.php?id=xyz12, now I want to remove the .php on all files, so if a person types /overview, it should open up overview.php. This is in my current htacess file

Options +FollowSymLinks
RewriteEngine On
RewriteCond %{HTTPS} !=on
RewriteRule ^ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]


RewriteCond %{SCRIPT_FILENAME} !-d
RewriteCond %{SCRIPT_FILENAME} !-f


RewriteRule ^(\w+)$ ./serve.php?id=$1
Ilya Dynin
  • 11
  • 4
  • 1
    Possible duplicate of [Removing the .php extension with mod\_rewrite](https://stackoverflow.com/questions/4908122/removing-the-php-extension-with-mod-rewrite) – localheinz Sep 04 '17 at 16:00

1 Answers1

0

All you have to do is:

Options +FollowSymLinks
RewriteEngine On

RewriteCond %{HTTPS} !=on
RewriteRule ^ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]


RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^([^\.]+)$ ./serve.php?id=$1 [NC,L]
Vural
  • 8,666
  • 11
  • 40
  • 57