Question

Nonexistent urls redirect to my homepage | WordPress LEMP

Posted January 20, 2021 166 views
NginxServer OptimizationWordPressLEMPInitial Server Setup

I’ve installed WordPress on a LEMP stack. When I go to a nonexistent url, I’m redirected to my site’s homepage. I don’t want this to happen. I want a nonexistent url to redirect to WordPress’s 404 page.

How can I get this to work on a LEMP stack?

For reference, here is my site: https://sequential.design/whatisthis/
https://sequential.design/holyhamster/
https://sequential.design/put anything here/

I used the Digital Ocean tutorials to set up my droplet and this specific tutorial, https://www.digitalocean.com/community/tutorials/how-to-install-wordpress-with-lemp-on-ubuntu-20-04, to install WordPress on my site, so my server settings are all standard.

I should mention that enabling pretty permalinks gets rid of this issue, but I want to use ugly permalinks.

1 comment

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.

×
Submit an Answer
2 answers

Hi there @DanielAlejandro,

It looks like that the 404 page works as expected when visiting a plain page:

https://sequential.design/?p=12

However, you need to choose the permalinks setting for your website (can be found in Settings > Permalinks) so that they not set to Plain.

Let me know how it goes.
Regards,
Bobby

As I stated in my question, “I should mention that enabling pretty permalinks gets rid of this issue, but I want to use ugly permalinks.”

I want to use plain permalinks. And I want nonexistent URLs to redirect to WordPress’s 404 page. Thus your solution is inadequate. I want 404s to work with plain permalinks.