My directory structure is
domain.com/project1
domain.com/project1/,htaccess
domain.com/project1/api.php
The .htaccess is
RewriteEngine On
RewriteRule /([^\.]+)/([^\.]+).(xml|json) /api.php?version=$1&url=$2&type=$3
So going to domain.com/project1/v1/users.json should direct me to domain.com/project1/api.php?version=v1&url=users&type=json but I get a 404 saying
The requested URL /project1/v1/users.json was not found on this server.
Additionally, a 404 Not Found error was encountered while trying to use an ErrorDocument to handle the request.
This rule should work from /project1/.htaccess
:
RewriteEngine On
RewriteBase /project1/
RewriteRule ^([\w-]+)/([\w-]+)\.(xml|json)$ api.php?version=$1&url=$2&type=$3 [L,QSA]
^
and $
to get precise matchingQSA
(query string append) flag.