I have this structure: site.com/api/index.php
. When I send data to site.com/api/
there is no issue, but I imagine it would be better if the api would work without the trailing slash also, like this: site.com/api
. This causes a 301 redirect and thus loses the data (since data isn't forwarded). I tried every re-write I could think of and couldn't avoid the redirect. This is my current re-write rule (though it may be irrelevant).
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^api/(.*)$ api/index.php [L]
Can I make this url work and maintain the post data without using the trailing slash?
Some rewrites that didn't work: (all still redirect)
RewriteRule ^api$ api/index.php [L]
RewriteRule ^api/*$ api/index.php [L]
/
from the rule and it would work. – Sensitive!-d
condition would probably have to be removed. that means if the requested file is not a directory and/api
is a directory so the condition will not match. – Sensitive