Weird URL Bug?
Hi there, I have a weird issue where some urls show a 404 error if they start with the word "destinations" or "yacht" in them e.g.
- 404: luxurychartergroup.com/fr/post.php/yacht-rapide-274/
- 200: luxurychartergroup.com/fr/post.php/rapide-274/
- 404: luxurychartergroup.com/post.php/destinations-eloigne-249/
- 200: luxurychartergroup.com/post.php/destination-eloigne-249/
See attached page code. I also checked the htaccess file and no weird rules in there.
Any idea what might be causing this?
CMS Builder v3.14 + plugins (see attached)
That is indeed a strange issue! The first thing I would want to check is if the 404 is being triggered by lines 19-20 in post.php because no $newsRecord was found, or if it's being triggered "natively" by the server and not loading post.php at all.
A simple way to do this would be to trigger a silent error by placing the following code around line 16 in post.php:
@trigger_error('DEBUG - Record Number: ' . whereRecordNumberInUrl(1));
And then trigger the 404 using one of the URLs in your post. Then, check the Developer Log in the Admin Menu to see if it logged this error. If it does, then we'll know that the request is reaching the page but the record is not being loaded correctly (it should also show what num - if any - is being grabbed from the URL). If no log entry shows up, then something in the server configuration (e.g. htaccess or apache configuration) is preventing this request from hitting the page.
Another thing I noticed, though it could just be a coincidence, is that the "problem words" also match two existing PHP files on your site - yacht.php and destinations.php. It may be worth looking into these pages as well.
Yep, so we are getting the following show up in the error log:
#3686 - E_USER_NOTICE: DEBUG - Record Number: num = '274'
/home/luxurychartergroup/luxurychartergroup.com/fr/post.php (line 17)
I suspect its related to the php files with a similar name as well, but not sure what to do next, any suggestion?
With this info, it seems likely to me that the cause of the 404 is not on this page itself. I would suggest checking through your include files (e.g. includes/headers.php) for any code that is checking for "yacht" or "destinations", or that can trigger a 404 error. If you're unable to find anything there, in order to troubleshoot further, we'll need to move this to a support ticket so I can have a look directly. You can start a ticket with this form: https://www.interactivetools.com/support/email_support_form.php