I have a website, using CodeIgniter, and running under NGinx.
I used these rewrite rules to cleanup the URL, and remove the index.php from the URL.
Unfortunately, I have a problem with AJAX queries which send POST arguments to the controller, as the controller receives no argument.
Using Firebug Lite, I can see that I give the correct POST parameters to the controller, but when I print them in the controller, nothing is printed.
I guess it is from the rewrite rules, which don't seem to pass the parameters along the URL, but I don't know how to fix that.
Would anyone have an idea?
Here are the rewrite rules, might be easier to have them here instead of on the other site:
if ($host ~* ^www\.(.*))
{
set $host_without_www $1;
rewrite ^/(.*)$ $scheme://$host_without_www/$1 permanent;
}
# canonicalize codeigniter url end points
# if your default controller is something other than "welcome" you should change the following
if ($request_uri ~* ^(/welcome(/index)?|/index(.php)?)/?$)
{
rewrite ^(.*)$ / permanent;
}
# removes trailing "index" from all controllers
if ($request_uri ~* index/?$)
{
rewrite ^/(.*)/index/?$ /$1 permanent;
}
# removes trailing slashes (prevents SEO duplicate content issues)
if (!-d $request_filename)
{
rewrite ^/(.+)/$ /$1 permanent;
}
# removes access to "system" folder, also allows a "System.php" controller
if ($request_uri ~* ^/system)
{
rewrite ^/(.*)$ /index.php?/$1 last;
break;
}
# unless the request is for a valid file (image, js, css, etc.), send to bootstrap
if (!-e $request_filename)
{
rewrite ^/(.*)$ /index.php?/$1 last;
break;
}
Thanks!