Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

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!

share|improve this question
2  
Your config is ugly. Please, see: wiki.nginx.org/Pitfalls –  VBart Oct 25 '12 at 9:09

1 Answer 1

i think, using rewrite (as in apache) does not forward post data, instead try to configure nginx as front proxy

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.