-2

I would like to know how I can rewrite the following URL:

mydomain.com/service-demo.php

so that it can be accessed using one of:

mydomain.com/service-demo/
mydomain.com/service-demo
mydomain.com/service-demo.php

but always show this:

mydomain.com/service-demo/
Adrian Mole
  • 49,934
  • 160
  • 51
  • 83
  • Check this https://stackoverflow.com/questions/4026021/remove-php-extension-with-htaccess – Arash Younesi May 17 '20 at 17:22
  • Does this answer your question? [Remove .php extension with .htaccess](https://stackoverflow.com/questions/4026021/remove-php-extension-with-htaccess) – jmaitrehenry May 23 '20 at 00:45

1 Answers1

0

create a new file (.htaccess ) in root folder and write this codes

RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME}\.php -f
RewriteRule ^(.*)$ $1.php [NC,L] 
Zhir
  • 16