Can't create a custom 404 page?

@Doobox what is the issue here Wrong Custom 404 Page Displaying

That thread has a lot of misleading/confusing information in it, so it’s hard to follow what the OP’s issue was/is.

Could you explain what the issue is, and why you’re telling people you can’t create a custom 404 page with RW?

I can’t see why you’d be saying that… you can create a 404 page in RW, publish it, and then configure your .htaccess to point at that custom 404 page… what am I missing? is there a bug in RW? if so, have you filed it with us?

@ben Have you tried creating a custom 404 this way?

Create a new stacks page in RW 404.html
set the folder to the root of your site.
Add : ErrorDocument 404 /404.html to the end of your htaccess file.

Done right? Nope it does not work.
It does present the 404.html page you just created, but every link in the page is relative to the page, and thus every link is broken.
Setting links are relative to any of the options in RW does not change this.
So you basically can’t present anything nice on that page.

The only solution is to bounce them onto another page from the 404.html with js as my new blog post you must have just seen.

Unless you have an explanation as to why me and everyone else sees the 404.html src url’s as relative to the page (broken) and you don’t?

Just watched your video, and I can only assume that there is something different about your server configuration and mine as well as the countless others that have posted in the forums about this.

What appears to be happening in your video is the browser is redirecting to the 404.html when triggered, so your relative urls in the 404.html page are all good. I suspect this is somehow being treat as a 301.

On my server and everyone else that is speaking about this, and what appears to be the normal result, is that when a 404 is triggered here for example
http://mysite.com/nonexistantpage

the 404.html page is served from the http://mysite.com/nonexistantpage

This makes all the relative urls in the page incorrect.

I’d say what your server in the video is doing is quite unique (rare).
Every article i see about creating custom 404’s streeses absolute urls, likely because of the way the 404.html is normally served from the location that triggered the 404 error.

@ben the reason things appear to work as expected in your video is because you are testing everything at root level.
All your urls to theme css etc etc are still good at root level.
If you were triggering a 404 in a subfolder of that test site the results would be very different (a broken 404 page).

All url’s in a custom 404 page must be absolute to work everywhere. Period. Your video is incorrect.

OK, now I see what the issue is: All page links are broken when your custom 404 page is displayed on a sub-missing-page.

So the fix for this is that RapidWeaver should be setting the full path to the page, rather than relative paths.

I’m going to file this and see if we can fix this in 7.

The reason I highlighted your post is because if you’re seeing an issue/bug like this, why haven’t you contacted us asking for a fix? It’s not good for anyone to be suggesting hacky workarounds.

You can likely make RW make everything RW makes an absolute url.

Not sure if Stacks and other 3rd party plugins will inherit the absolute url to their files though (e.g. image).

Some themes have relative links back to the home page hard coded.
Not to mention url’s that are in the page provided by third party stacks, and user defined custom code.

At the end of the day, a custom 404 page is normally custom created by someone that knows how to code.
Of course this means that that someone can simply hard code absolute url’s where ever url’s appear in their custom creation.

Making RW generate absolute url’s across the entire site seems overkill to appease the creation of a custom 404, as well as the points above that highlight you may never be in full control of every url in the page anyway. I think you’d be flogging a dead horse.

The workaround ain’t that hacky. :slight_smile:

What I think would be better and another feature for Rapidweaver to hang it’s hat on would be a new page type.
This way you could give them the ability to generate some sort of custom 404 with a full screen background and some text and a button or something you dream up as a sort of template for the 404 page, and have full control over it.

3 Likes

Or a select drop down in the Site Setup that would allow you to select any existing page and designate that page as your 404. Then you could design it using any page style you like. Say, a nice stacks page for instance. :wink:

3 Likes

2 Likes

Yes!!! Love this idea. Of course it means writing the .htaccess file – which is error prone, server dependent, etc. etc.

I’d love that feature. So glad I don’t have to build that feature. :wink:

2 Likes

ok, this was a little more tricky to implement that I first imagined (hah!).

We’re looking at adding custom error page support in a 7.x release.

1 Like