rejetto forum

Can I use my own 404 page?

0 Members and 1 Guest are viewing this topic.

Offline pepsiru1es92

  • Occasional poster
  • *
    • Posts: 6
    • View Profile
I am fully aware of how to edit HFS's purple 404 page to say different things, but is there a code to just use a page I made (404.html)?

Thanks


Offline Mars

  • Operator
  • Tireless poster
  • *****
    • Posts: 2063
    • View Profile
This is only an example adapted to the request made by ppsiru1es92, there are the other possibilities but based on this principle because it is inescapable to pass by the section [error-page] as follow:

In the template, all the sections ' page of error ' are integrated  into a section parent [error-page] trough the var %content%. If you wish to personalize the page 404, it is necessary to personalize the section [not found] by changing the section [error-page], which is then shared between two joined sections each in the other pages of error.

new template:
Quote
[error-page]
%content%

[error-page-head]
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN">
<html>
  <head>
  <meta http-equiv="content-type" content="text/html; charset=UTF-8">
  <style type="text/css">
  {.$style.css.}
  {.$style.user.}
  </style>
  </head>
<body>

[error-page-end]
<hr>
<div style="font-family:tahoma, verdana, arial, helvetica, sans; font-size:8pt;">
<a href="http://www.rejetto.com/hfs/">HttpFileServer %version%</a>
<br>%timestamp%
</div>
</body>
</html>

[not found]
<!-- this code redirect the user to the URL defined in the next line , the redirection is immediate-->
<METAR HTTP-EQUIV="Refresh" CONTENT="0; URL=http://myserver/404.html">
<!-- META HTTP-EQUIV="Pragma" CONTENT="no-cache" -->


[overload]
{.$error-page-head.}
<h1>{.!Server busy.}</h1>
{.!retry later.}
{.$error-page-end.}

[max contemp downloads]
{.$error-page-head.}
<h1>Download limit</h1>
{.!max s dl msg.}
{.$error-page-end.}

[unauthorized]
{.$error-page-head.}
<h1>Unauthorized</h1>
Your username and password don't match, or you are not allowed to access this resource.
{.$error-page-end.}

[deny]
{.$error-page-head.}
<h1>Unallowed</h1>
{.or|%reason%|This resource is not accessible..}
{.$error-page-end.}

[ban]
{.$error-page-head.}
<h1>You are banned.</h1>
%reason%
{.$error-page-end.}

It is obvious that the used macros  are compatible only with the beta version of hfs (the last one is the build 247 on this post). ;)

« Last Edit: October 16, 2009, 08:13:06 AM by Mars »


Offline pepsiru1es92

  • Occasional poster
  • *
    • Posts: 6
    • View Profile
Well, I'm using build 155, so just for the hell of it I copy/paste'd the HTML from my 404 page and it worked. Thanks for your help Mars!

Also, if you care to see, here's the end result.

http://trg.servegame.com/deadlink.txt
« Last Edit: October 16, 2009, 09:32:22 PM by ppsiru1es92 »