Hey there,
Hope you’re well today! 🙂
It sounds from what you’re saying that you’re using the default permalink like:
/?p=123
Is that right?
If so, anything like:
/?p=123asdasd
/?p=123opwkjoijwf
/?p=123kjlwrkgjlkjg
Would return a 404 as it’s part of the querystring. However, anything like:
/aiuhfushdfkjs
Wouldn’t give the WP error page if there is nothing catching the error, so you’ll get the server 404 error page instead.
You can read up more here:
http://codex.ww.wp.xz.cn/Using_Permalinks
http://codex.ww.wp.xz.cn/htaccess
And I’ve not tested this one, but:
http://winginx.com/en/htaccess
Hope this helps. 🙂