Creating a 404 Page, Not a Site


(Michael Kane) #1

I’d like to add a 404 page to a website. The web site already exists and is functional with index.html and then the files that RW generates, such as:

sitemap.xml
files
resources
rw_common

These files already exist in the directory; so if I publish them I get queries as to whether I want to overwrite files. I don’t, because to do so would break the underlying site.
So how do I upload a single page?

Obviously you can’t link to a 404 page–a 404 page is a destination you’re directed to when links don’t work or when a page doesn’t exist.

There are several ways to create 404 pages; most involve editing .htaccess files. Another way–supposedly–is to create a single 404.shtml file.

The page looks great in preview (and as published locally) using RW and Stacks. But I don’t know how I can publish it effectively.

How can I do so without breaking the underlying page?


(Jannis from inStacks Software) #2

(Doug Bennett) #3

On some web servers this might not work, I wouldn’t recommend it instead use your htaccess or some hosts have it available as a cPannel option.

In addition to the links Jannis gave you if you’re a paid member of the rapidweaver community @ben has a tutorial
https://rapidweavercommunity.com/tutorials/advanced-topics/custom-404-error-pageshttps://rapidweavercommunity.com/tutorials/advanced-topics/custom-404-error-pages

Not sure why this is still for paid members only, as I thought @dan had said paid tutorials would be for using addons and not the base product.


(Michael Kane) #4

The first one doesn’t help at all. Is the author suggesting, when he says, “Create 2 new pages in your RW project” that you create a 404 project with two pages or add two 404 pages to an existing project? With respect to the former, you have precisely the problem I cited–two different sets of common files that will overwrite each other. If the second, you can’t add it to an existing project because of different themes, for one. This also suggests that you put the .shtml file under the server’s root, and not under html. So the first tutorial is useless and does not answer the question. The second example also fails to answer the question. There the venerable Will Woodgate suggests, “If you want to customise the error message shown, login to your web hosts (sic) CPanel and use the Error Pages option.” That’s great if your webhost has such a panel/service. Mine does not. So how do you get around the problem of overwriting common files as I asked in the question?


(Jannis from inStacks Software) #5

Really do not know what you are doing there. Seems it isn’t your site or you are in existence of the original RW project.

The dead simplest way is to create a dedicated 404 page in RW (either in root with the name 404.html or in a sub folder) and point in your htaccess file to that.

The first link perfectly showcases that.

Of course there are always more difficult ways of achieving what you want…


(Michael Kane) #6

Here’s what MT says:
%%%%%%%%%%%%%
Me: The problem is that the html file is already populated with Rapidweaver common files; the 404 file doesn’t have access to these and they cannot be renamed for the 404 file.
Read
Katie B.
I’m sorry Michael, but that is an issue with your site not your server. In order to serve the files you need to put them on the server in a way that they can be read by web browsers accessing your site.

%%%%%%%%%%%%%%

Is there a way to rename the auxiliary files that RW creates and associates with the 404 page say, “sitemap2.xml” and “rw_common2” instead of sitemap.xml and “rw_common” to distinguish them from the published themes and common files used in the site as a whole?


(Michael Kane) #7

If the dedicated 404 page:

didn’t use themes
didn’t use graphics
didn’t create its own sitemap.xml file
didn’t create its own RW common folders

Your advice would work. The problem is you can’t have files with the same name sitting in the same directory.

Now if you are saying I can modify .htaccess so that it links to say,
domain\404\404.html by creating a new subdirectory and putting the 404 common files there, that would be a solution.

I didn’t see that showcased, or even mentioned. And of course, that doesn’t address the .shtml solution, but that won’t work on every server.


(Jannis from inStacks Software) #8

Sure that works…

A bit of research from your side would be beneficial. All of your questions would have been able to be solved by yourself with some basic internet research. So go on and good luck…


(Michael Kane) #9

Create a site using RW.
Publish the site under a domain.
The file structure will look like this:

/domain/index.html
/domain/sitemap.xml
/domain/files
/domain/resources
/domain/rw_common

To create this site, you’ve used stacks and themes that make you happy. But you want something else for a 404 page. So you go back to Rapidweaver and creae a new project. Call if 404.html.

If you publish locally, you will see:

404.html (because that’s the name you gave it)
sitemap.xml
files
rw_common

If you try to publish this wonderful 404 page, you will have conflicts between the existing files and folders and the new files and folders, except for the file “404.html” because this does not exist under /domain.

All the other ones do.

The first tutorial suggests, though ambiguously, to add a custom 404 page to each site, i.e., to each index.html file or project. My experience (admittedly, limited) suggests that it is difficult to use a completely different theme for such a page when an existing theme is being used (putting asing Bootstrap, Foundation and Blank themes). So making a separate RW project for a 404 page makes sense–except that you can’t rename the automatically generated files. You can do so manually, but then the links are broken. You can’t rename them from within RW, as far as I can tell.

So the custom 404 page exists happily on the local machine but can’t be uploaded without wreaking havoc.


(Jannis from inStacks Software) #10

To make a long story short: if you do not have the original RW project file, you aren’t able to create a 404 page in the way the other files are created.

If you have the original RW project, you do not have conflicting files.

Not able to help much more here…

Cheers, Jannis


(Doug Bennett) #11

Not sure what you’re trying to do. There’s no such thing as an RW project without a theme. You can select a different theme, and you can have different themes for each page(page inspector).

So add the page to the existing project, change the theme to what you want and publish it.

I’m not sure why you’re trying to do your error page (404) in a different project. From a user experience, you’d want to have all the navigation links to get back to a proper working page. After all, they got there by mistake so you’d want to make it easy as you can to get to a valid page.

From a users experience, I’m not sure why you want a different theme for an error page, but you can.


(Michael Kane) #12

I don’t want the 404 page to conform to the style of the individual web site.


(Michael Kane) #13

There are 25+ domains so it makes sense to have a single 404 web page project rather than adding the page to each separate domain.


(Michael Kane) #14

This seems to be a workaround:

  1. Open locally published RW-created page in a text editor.
  2. Rename all instances of /rw_common to /rw_common2
  3. Rename all instances of /files to /files2
  4. Rename all instances of /resources to /resources2
  5. Save file.
  6. Rename the corresponding files and folders.
  7. Now these can be uploaded with no conflict to each of the domains.

A sitemap.xml file isn’t essential, and I don’t know what would be the effect of having a file called “sitemap.xml” and “sitemap2.xml” under each domain, so the new “sitemap.xml” created by RW for the 404 file won’t get uploaded.
We’ll see if the *.shtml solution (in lieu of an .htaccess solution) works on this server.


(Doug Bennett) #15

Not sure why you’re going through all that. Your newly created project that only contains the 404 page won’t have any navigation back to the real site.
Usually, a user gets a 404 because they miss typed the URL to a page. The 404 the way you created it, wouldn’t even give them a clue as to how to find what they were wanted.

With all the time you’ve spent trying to figure this out, you could have copied the page to the 25 project files and been done.

It’s your site, just wanted to make sure new users realize the pitfalls of the approach you’ve taken.


(system) #16

This topic was automatically closed 6 days after the last reply. New replies are no longer allowed.