Only home page on my wordpress site is working but all the links are 404 Not Found nginx/1.4.6 (Ubuntu) Any suggestion what should I do ?
These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.
Guys… work fine but you have to use: try_files, not tryfiles… like code below
location / {
# First attempt to serve request as file, then
# as directory, then fall back to displaying a 404.
try_files $uri $uri/ /index.php?q=$uri&$args;
#try_files $uri $uri/ =404;
# Uncomment to enable naxsi on this location
# include /etc/nginx/naxsi.rules
}
Hi MARKOVIC.ANDRIJA, It’s seems like you did not configured your server configuration file in /etc/nginx/sites-available folder properly. Check that you have put try_files $uri $uri/ /index.php?q=$uri&$args; instead of try_files $uri $uri/ =404; It will fixed your 404 error hopefully. Thank You M A Kashem CEO Xponent Info System (PVT.) LTD.
Alright, this answer more likely related to WordPress in subdirectory put this in your site configuration block
location ^~ /eng{
#alias /var/www/example.com/eng;
root /var/www/example.com;
index index.php;
try_files $uri $uri/ /eng/index.php$is_args$args;
location ~ \.php$ {
root /var/www/example.com;
include fastcgi_params;
fastcgi_buffers 256 4k;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
fastcgi_pass unix:/run/php-fpm/www.sock;
}
}
this will work with root directory but you need to remove eng
(my subdirectory name) from the code above
the magic thrick is this line
try_files $uri $uri/ index.php$is_args$args;
Yeah it worked like a charm
Edit file /etc/nginx/sites-available/xyz.vhost
and following under index line
index index.html …
try_files $uri $uri/ /index.php?$args;
This worked for me, replaced the mention portion with
try_files $uri $uri/ /index.php?q=$uri&$args;
Don’t forget after you will need to reload ngix
sudo service ngix reload
It’s not work for me either.
Click below to sign up and get $100 of credit to try our products over 60 days!
@markovic.andrija What did you do for solve the error? I’m havind the same problem here.
This comment has been deleted