Hi Friends,
I recently migrated my site from Apache to Nginx and everything seems to be working except page navigation links on homepage ( mysite.com/page/2). When I click them all of them redirect back to homepage. It might be due to an incorrect redirect setting but I am not able to figure it out and posting it here for help. Here’s my nginx.conf –
server {
listen 80;
server_name mysite.com;
location / {
root /home/userid/public_html;
index index.php index.html index.htm;
try_files $uri $uri/ @rewrites;
}
location @rewrites {
# Can put some of your own rewrite rules in here
# for example rewrite ^/~(.*)/(.*)/? /users/$1/$2 last;
# If nothing matches we'll just send it to /index.php
rewrite ^ /index.php last;
}
error_page 404 /index.php;
location = /404.html {
root /home/userid/public_html;
}
error_page 500 502 503 504 /index.php;
location = /50x.html {
root /home/userid/public_html;
}
location ~ \.php$ {
root /home/userid/public_html;
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include fastcgi_params;
}
}
Thanks,
Mick