Reputation: 575
I'm using my .htaccess to rewrite the Authorization header to a get param. Why I do this is described here.
So my problem is that when I'm using a query string when I request my API the old query string is removed from the URL. What I want to do is append a query called "Authorization" instead of just rewrite everything behind my index.php as it's done here.
RewriteEngine on
RewriteBase /api/
# Allow any files or directories that exist to be displayed directly
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php/$0 [L, QSA]
RewriteCond %{HTTP:Authorization} ^Basic.*
RewriteRule ^ index.php?Authorization=%{HTTP:Authorization} [L]
Any ideas?
Upvotes: 2
Views: 532
Reputation: 785058
Have it this way:
RewriteEngine on
RewriteBase /api/
# Allow any files or directories that exist to be displayed directly
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php/$0 [L,QSA]
RewriteCond %{HTTP:Authorization} ^Basic.*
RewriteCond %{QUERY_STRING} !Authorization=[^&]*
RewriteRule ^ index.php?Authorization=%{HTTP:Authorization} [L,QSA]
Upvotes: 4