0

Hello when I call this api,

https://restapiaseem.000webhostapp.com/api/employees/get.php?id=10036

I receive below as response from my server,

{
"id": "10036",
"name": "Karun Nair",
"designation": "Marketing Head",
"mobile": "6988889799",
"email": "karunnair@gmail.com"
}

Is there any way to call this api look like this (removing the .php extension) https://restapiaseem.000webhostapp.com/api/employees/get?id=10036

Rahul Khatri
  • 1,502
  • 2
  • 13
  • 25
Aseem Salim
  • 201
  • 2
  • 8

1 Answers1

0

You need to configure your web server(Apache Nginx, IIS) to Rewrite the URL or reroute them.

Vindic
  • 627
  • 6
  • 8
  • i am new to this can you explain please? – Aseem Salim Nov 18 '19 at 06:17
  • The solution is on the server part//configuration. Which server do you use ? – Vindic Nov 18 '19 at 06:18
  • apache .htaccess 000webhost is my hosting – Aseem Salim Nov 18 '19 at 06:24
  • solved by writing these things on my .htaccess fileRewriteEngine on RewriteCond %{REQUEST_FILENAME} !-d RewriteCond %{REQUEST_FILENAME}\.php -f RewriteRule ^(.*)$ $1.php [NC,L] – Aseem Salim Nov 18 '19 at 06:30
  • You should take a look to the documentation of apache : https://httpd.apache.org/docs/2.4/rewrite/remapping.html or this interesting thread in SO https://stackoverflow.com/questions/43967770/mod-rewrite-handle-url-request-without-php-extension – Vindic Nov 18 '19 at 06:30