Strange 404 result


#1

I’ve removed the timed redirect so this is easier to check. The actual 404 page on my site is showing up correctly https://colourmanagementpro.com/404.shtml however if I go to any incorrect url the page is suddenly all wrong and it worked fine previously https://colourmanagementpro.com/hgsdg/

Does anybody know what could be going on here? I use CloudFlare but I’ve cleared the cache several times and this continues.


(Nik Fletcher) #2

This is because you’re using relative links on a page that is served up differently from the rest of the site.

Your server loads the 404 page, but instead of reading the references relative to your 404 page’s location on the server it resolves them to be relative to the location of the page you’re requesting. You’d need to use either absolute URLs or DOCROOT relative URLs to make this work.

—N


#3

I am using DOCROOT. This happened after I changed to DOCROOT this morning. The links in the header and footer are also inside Partials so they should be the same as everywhere else on the site. It actually worked fine before when I had the pages and links set as Relative to Page with absolute urls.


(Nik Fletcher) #4

In that case, I’d probably check with your hosting provider. It might be that they’re expecting things to be the other way round (relative, not DOCROOT) but that’s not something RW can directly affect or change.


#5

OK thanks I’ll try looking in cPanel and then contact the server manager if it still doesn’t work.


(Steve Jenkins) #6

I am using Armadillo and you need to use relative to page in order for it to work. This is an issue with my host (chillidog). The styling on my page is lost when a bad url is used. Hope there is a solution somehow. My web host does not support php.ini files.


#7

I eventually discovered that in my case the problem was the trailing / at the end of the URL. If somebody went to /jdhfighwefg it came up with a correctly formatted 404 page but if they go to /jdhfighwefg/ formatting is broken.

I never actually asked my web host about this because I wasn’t sure where the problem lies here but my pages are still relative to DOCROOT. The usual page structure on my site is domain/page/index.html. By leaving that trailing / but redirecting to an .shtml page it seems to cause problems.


(Steve Jenkins) #8

Well, the issue is that armadillo requires rw be relative to pages be set. I need to contact Jonathan about this. In order for error pages to work properly the rw needs to be set to relative to Docroot.


#9

My error page worked correctly when RW was set as relative to Page. For some reason it just breaks formatting if there is a / after the incorrect url. My guess and it’s only a guess is that due to my page structure RW treats something like domain/jhgghkhj/ as a folder which logically doesn’t exist so a 404 message appears, however the 404 page lacks the expected CSS in this scenario.

The only real advantage I see with setting links as relative to DOCROOT is that it’s simply easier and less risky adding page links on a page. One disadvantage is that Mamp no longer works for me and all the formatting is broken when trying to view the site on the localhost.


(Steve Jenkins) #10

I tried each of the three Relative settings for the links and non of them work on a test site without any php. The Error console on Safari shows that style sheets are not being put in the right place, the server cannot find the files and the formating is lost.


#11

I am not familiar with the workings of either Armadillo or Chillidog, so in this instance I think that putting them in touch to work out a solution might be the best strategy. It doesn’t sound like something that you can easily solve on your own.