Search code examples
apachemod-rewriterestler

RewriteCond: unknown flag 'QSA'


When configuring Restler it suggests creating the following re-write rule:

DirectoryIndex index.php
<IfModule mod_rewrite.c>
   RewriteEngine On
   RewriteRule ^$ index.php [QSA,L]
   RewriteCond %{REQUEST_FILENAME} !-f
   RewriteCond %{REQUEST_FILENAME} !-d
   RewriteRule ^(.*)$ index.php [QSA,L]
</IfModule>

I have put this into a .htaccess file in root of my REST directory but I'm getting a 500 Server error when this rule is being fired. The error message the apache error log is:

[Wed Oct 10 10:39:30 2012] [alert] [client 127.0.0.1] /public/api/.htaccess: RewriteCond: unknown flag 'QSA'
[Wed Oct 10 10:39:30 2012] [error] [client 127.0.0.1] File does not exist: /public/favicon.ico

I assume the lack of a favicon.ico file can be ignored but I am concerned about the "unknown flag 'QSA'" error. I know very little about rewrite rules so any help there would be appreciated.

For those familiar with Restler, I am using 3.0.0rc2 (if that matters). Also it's worth pointing out that using the explicit call to index.php works so much as I then get a 404 JSON error response (a positive improvement) but as indicated above if I rely on the rewrite rule then I just get a 500 Server Error:

http://localhost/api/index.php/say/hi    - WORKS (gives JSON 404 error)
http://locahost/api/say/hi               - 500 SERVER ERROR

Solution

  • Interesting ... I was looking into my JSON 404 message and found this post:

    Restler always returns not found

    It not only solved my 404 error but also helped to fixed the 500 Server error. The only thing I needed to do was change the http.conf's AllowOverride to All.

    I'd still be interested if anyone could tell me WHY this is happening but the this does now work.