json - .htaccess folder to index.php and file to file -


i'm creating api specific part of webapplication. api located in subfolder api. see folder structure below:

- api   - cars      - index.php      - count.php 

however, tricky part. customers requesting endpoints end json:

cars.json => cars/index.php cars/count.json => cars/count.php

i'm not expert in rewrites. possible?

try in htaccess :

rewriteengine on rewriterule ^cars\.json$ /cars/index.php [nc,l] rewriterule ^cars/count\.json$ /cars/count.php [nc,l] 

the first rule rewrites cars.json cars/index.php , second rule rewrites cars/count.json cars/count.php .


Comments

Popular posts from this blog

c# - Binding a comma separated list to a List<int> in asp.net web api -

Delphi 7 and decode UTF-8 base64 -

html - Is there any way to exclude a single element from the style? (Bootstrap) -