vongolashu
vongolashu

Reputation: 375

htaccess to Nginx Rewrite - Ajax/Jquery not working

I installed a script and it had htaccess for apache but I use nginx so I used the online htaccess to nginx conversion tool and converted my htaccess

<IfModule mod_rewrite.c>
RewriteEngine on
RewriteBase /
RewriteRule ^uploads - [L,NC]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)/?$ index.php?rp=$1 [L]
</IfModule>
<ifModule mod_headers.c>
Header set Access-Control-Allow-Origin: *
</ifModule>

to

#ignored: "-" thing used or unknown variable in regex/rew 
if (!-f $request_filename){
set $rule_1 1$rule_1;
}
if (!-d $request_filename){
set $rule_1 2$rule_1;
}
if ($rule_1 = "21"){
rewrite ^/(.*)/?$ /index.php?rp=$1 last;
}

After that the rewrite rules are working for site and I can almost use and browse the site but there is only a small problem, the jquery/ajax links in my admin panel are not working.

They are mostly "Collapse" type tabs.

Example: moderator/?sk=videos#collapse0

Any idea what could be wrong ? I am on centos 6, nginx with php-fastcgi

Upvotes: 2

Views: 2598

Answers (1)

Mohammad AbuShady
Mohammad AbuShady

Reputation: 42799

I don't know what the uploads rewrite do, but the second one is

location / {
  try_files $uri $uri/ /index.php?rp=$request_uri;
}

Upvotes: 1

Related Questions