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 -

how to prompt save As Box in Excel Interlop c# MVC 4 -

xslt 1.0 - How to access or retrieve mets content of an item from another item? -