Wordpress shows homepage (200) instead of 404 in > third url segment - wordpress

I'm currently running into a strange problem with Wordpress on my production server. When I try to visit non-existing URLs, Wordpress doesn't trigger a 404 when the url has more than 3 segments, for example:
These pages don't exists and trigger a 404 page:
http://example.com/9
http://example.com/9/9
These also dont exist, but don't trigger a 404 page and show the homepage (with 200 response code):
http://example.com/9/9/9
http://example.com/9/9/9/9
http://example.com/9/9/9/9/9
On my local machine all above pages show a 404 (as expected). The server (and my local machine) are both running nginx >10.16, both nginx vhost configs are almost equal. Running PHP72-fpm.
Debugging I already did:
Disable functions.php in theme folder
Disable all plugins
Switch to other theme
Disable cloudflare caching
Flush permalinks
All without any success unfortunately.. I'm kinda running out of options for debugging, I hope anyone has got any suggestions!

I just found out that locally I'm running PHP73, on the production server PHP72. I've just upgraded the production server from PHP72 to PHP73 and the problem seems to be fixed!

Related

Why is WordPress redirecting to localhost

I have a WordPress website running on a server, using a docker container (with port forwarding 8001:80), and an Apache server with proxypass to redirect "demo.travel-itineraries.com" to "localhost:8001".
My problem is that WordPress redirects to localhost instead of using the website URL I specified.
My WordPress configuration doesn't contain any "localhost" occurrence (I tried SELECT * from wp_options where option_value like '%localhost%'; and there is no occurrence of localhost)
The WordPress address is set correctly
The homepage is working fine (http://demo.travel-itineraries.com/) but the second page isn't. If you check the link in the navbar, it's a link to "http://demo.travel-itineraries.com/les-joyaux-de-ladriatique-a-bord-du-pacific" but WordPress redirects to "http://localhost/les-joyaux-de-ladriatique-a-bord-du-pacific".
I checked with curl, and the RedirectedBy header is set to "WordPress".
Do you have any idea why it keeps redirecting?
Thanks
Worth a try: There is an extremely old bug in Wordpress which causes problems in permalinks (i.e. pages are not found) after moving the site to another server or directory even though everything is set correctly.
And there's the also-extremely-old fix for it to go to the backend, open the Settings > Permalinks page, change any one little detail, change it back again and click "save changes". And I've heard from others that often it's even enough to just open that Permalinks page without changing or saving anything.
I just had that again in the current version (5.8.3) – same problem, same fix. I really wonder why that bug still exisits...
I noticed Yoast is installed, the premium version of that plugin automatically creates redirects, you can check those by going to SEO > Redirects in the back-end.

Wordpress 404 issue after Migration in Plesk (Nginx config issue)

I recently migrated my website to DigitalOcean under plesk panel using all in one migration plugin. I kept having issues with 404 error only for pages that used permalinks configured as %postname%. For better URL format for my Content. But now if I enable the permalink I keep getting 404 error.
I used the popular suggestion of editing the nginx conf file through (through putty).
https://www.cyberciti.biz/faq/how-to-configure-nginx-for-wordpress-permalinks/
I wasn't sure of the save and exit step given after using the editor. ctrl+X shows a set of ^O^D commands. I pressed ^O and restarted it.
Now my entire website looks broken. Due to many 500 internal errors. What am I doing wrong here? kindly help me out please?
My website address is https://ourmoon.life/

After moving site to other host, i get 404 on posts

I moved my site from host A to host B. Now homepage opens and shows posts but when I click on any post or page, it gives 404 error.
I changed .htaccess file with various variations but no result. When I changed permalinks to default (?=id), it started working fine.
Now if I change permalinks back to postnames, it again gives 404 error.
My site is http://mixapk.net/
According to this this article, main reason for this might be the server configuration missing mod_rewrite module being loaded.

getting 404 error on wordpress pages

I've seen some other people with the same issue on net,
but the solution that worked for them (updating the .htacess file), didn't go very well for me!
I used buddypress to migrate my wordpress site to my local pc, but after everything is setup, only the home page is working, other posts or pages are getting 404 errors, I also tried to deactivate plugins and changing the theme, but nothing worked.
I'm on windows 10 and i'm using wampserver 2.5.
I think that the issue is caused by Apache, but I don't know how to fix it!
my Apache version is 2.4.9
Thanks in advance guys :)
Your site’s permalink (WordPress Admin > Settings > Permalink) is set as Default, please change it to any of the other option available below. e.g: Day and name, Post name etc.
Then you’ll be able to access the board instead of the 404 error.
Another way is troubleshooting:
WordPress sites can complicate the 404 troubleshooting process. Why? WordPress is a content management system that processes its own internal rewrite array as a part of its permalinks feature.
The first step to troubleshooting 404s is to figure out whether the 404 is being caused by the web server or by WordPress.
Static file
If your file is static (e.g. a jpg image) open your FTP client and verify that the file exists.
As an example, let’s say that the URL http://example.com/wp-content/uploads/picture.jpg is producing a 404 error. You will want to:
Open FTP Client and connect to your server (if you don’t know how to do so, read this.)
Navigate to the file’s location
Verify that the file exists
If it is does not exist, you have found the source of your 404.
However, it it does exist, yet pulling the URL up in a browser results in a 404 error, continue on to find out whether the issue is web server-based or WordPress-based.
Reference Link: http://websynthesis.com/fixing-wordpress-404-errors/

Wordpress 404 handler with PuPHPet Vagrant

I am struggling to make this work - my current 404 page is served from Apache, so I can't reach my theme's 404 page nor use a plugin like media-placeholder as the 404 will have to be server by Wordpress' 404 handler instead. I've generated my Vagrant machine using PuPHPet and there's no option that covers this issue.
Seems I found out how to make it work: under config.yaml > apache > files_match I've added fallbackresource: 404.php. Provisioned the machine again after that and regenerated my htaccess file by saving the permalinks again. Lookin good so far!

Resources