RewriteEngine on
RewriteBase /

### TODO Allow user to visit site using no trailing slash, without
### getting the entire url appended at the end
###
### e.g. https://site.com/v1/?url=/v1/index.php
RewriteCond %{REQUEST_URI} !v1/(.*)
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule .* http://%{HTTP_HOST}/v1/ [QSA]
RewriteRule ^v1/(.*)/?$ src/index.php?segments=$1 [QSA,L]

# This is for when devs should be able to set their own base url
# RewriteCond %{REQUEST_FILENAME} !-f
# RewriteRule ^(.*)$ src/index.php?segments=$1 [QSA,L]
