Weird URL Bug?

4 posts by 2 authors in: Forums > CMS Builder
Last Post: September 25, 2018   (RSS)

By theclicklab - September 17, 2018

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/

OR

  • 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)

By daniel - September 18, 2018

Hi,

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.

Thanks,

Daniel
PHP Programmer
interactivetools.com

By theclicklab - September 20, 2018 - edited: September 20, 2018

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)
https://www.luxurychartergroup.com/fr/post.php/yacht-rapide-274/

I suspect its related to the php files with a similar name as well, but not sure what to do next, any suggestion?