Hi,
This was working fine on the dev server but since deploying to live, error pages are not displaying.
If I manually enter an address that doesn’t exist (eg index.php?id=999) then a default page not found IIS error is being displayed.
If I navigate directly to the error page (in this case index.php?id=39) then it displays fine so it doesn’t seem to be an error with the page itself.
No form of url re-writing is being used here.
Any ideas? Cheers!
-
☆ A M B ☆
- 711 Posts
Hi,
To have IIS direct the users to MODx on a 404 you need to set your custom error page setting in IIS for
404 /index.php
This will then send the user to your MODx 404 handler, just make sure you enable ISAPI Rewrite as well otherwise you will find that form data will be lost if you just rely on the above.
Aaron
Cheers, I’ll give it a go.
The thing that is confusing me is that index.php clearly exists, so I would’ve thought index.php?id=xx (where xx is a missing page) would be handled by modx as the id is just a variable being passed to index.php it’s not like i’m entering mysite.com/randomrubbish.php. So as index.php exists I didn’t think IIS would even become involved, is my understanding wrong here?
Thanks.
-
☆ A M B ☆
- 24,524 Posts
MODx processes its internal "file not found" by forwarding to its "not found" page with a 404 header. IIS sees that 404 header and doesn’t bother to send the forward request on to MODx, diplaying the IIS "not found" page instead. So you have to tell IIS to go ahead and continue with the forward request even if there is a 404 header.
Thanks for the explanation sottwell.
Does this mean that in IIS I should set the custom error page for a 404 in IIS to /index.php or /index.php?id=39 (39 is the ID of my error page).
Unless I’m doing something wrong, setting it to index.php is just displaying the homepage however setting it to index.php?id=39 means that it isn’t possible to change the error page from within modx without changing IIS settings, is this correct?