Reputation: 639
So I'm developing an API for a dashboard that I'm working on. I want to change the API urls to look a bit nicer and so Ive looked into RewriteRule. It seems to be redirecting fine but $_GET and $_REQUEST are empty. Here is my .htaccess file (which is in /dashboard/) rule:
Options +FollowSymLinks
RewriteEngine On
RewriteBase /
RewriteRule ^dashboard/api/1/(user|venue)/?([^/]*)/?([^/]*)/?$ api.php?type=$1&action=read&id=$2 [QSA,L]
Like I said, its actually hitting api.php, but type
, action
, and id
aren't available in the request variables in php?
Upvotes: 0
Views: 70
Reputation: 24448
What about this?
Options +FollowSymLinks
RewriteEngine On
RewriteBase /
RewriteRule ^dashboard/api/1/(.*)/(.*) api.php?type=$1&action=read&id=$2&%{QUERY_STRING}$ [L]
Upvotes: 1