Replies: 0
If I go to https://sequential.design/randomURL (which doesn’t exist on my WordPress site), I am redirected to my homepage. It can be any URL, for example: https://sequential.design/imthepresident https://sequential.design/givemechocolate.
I want these nonexistent URLs to redirect to the WordPress 404 page. I’m using plain permalinks. If I switch to other kinds of permalinks, I can get nonexistent URLs to redirect to the 404 page, but not when I use plain permalinks (which is what I want to use). How can I get nonexistent pages to redirect to my 404?
I’m using NginX. Here is the beginning part of my server block configuration settings:
server {
server_name sequential.design www.sequential.design ;
root /var/www/sequential.design;
index index.html index.htm index.php;
location / {
#try_files $uri $uri/ =404;
try_files $uri $uri/ /index.php?$args;
}
location ~ \.php$ {
include snippets/fastcgi-php.conf;
fastcgi_pass unix:/var/run/php/php7.4-fpm.sock;
}
location ~ /\.ht {
deny all;
}
location ~ ^/\.user\.ini {
deny all;
}
location = /favicon.ico { log_not_found off; access_log off; }
location = /robots.txt { log_not_found off; access_log off; allow all; }
location ~* \.(css|gif|ico|jpeg|jpg|js|png)$ {
expires max;
log_not_found off;
}