Let’s say I have a structure like this https://domain.com/api/rest/v1.0/
, but in the folder v1.0
I have subfolders like data-model
and constants
.
Now let’s say I’m using mod rewrite, so all URLs that have the base URL https://domain.com/api/rest/v1.0/
get forwarded to https://domain.com/api/rest/v1.0/index.php
.
Would this affect my PHP files contained in https://domain.com/api/rest/v1.0/data-model/
and https://domain.com/api/rest/v1.0/constants/
?
For example, if in https://domain.com/api/rest/v1.0/index.php
I try to add a file from https://domain.com/api/rest/v1.0/constants/
using require_once
, would that cause some kind of redirect loop?
I’m not getting any output after the lines of code where I do the above, but am before. Similarly I’m not getting any errors/reloading of the page in the browser so am at a bit of a loss.
If this is the issue, does anyone have any pointers to a better REST file structure than just lumping all the files in the root folder?
Thanks
UPDATE
Here is my rewrite rule:
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule api/rest/v1.0/(.*)$ api/rest/v1.0/index.php?request=$1 [QSA,NC,L]
</IfModule>