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
Post a Comment