rejetto forum

Software => HFS ~ HTTP File Server => HTML & templates => Topic started by: pepsiru1es92 on October 15, 2009, 11:00:22 PM

Title: Can I use my own 404 page?
Post by: pepsiru1es92 on October 15, 2009, 11:00:22 PM
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
Title: Re: Can I use my own 404 page?
Post by: Mars on October 16, 2009, 07:52:51 AM
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). ;)

Title: Re: Can I use my own 404 page?
Post by: pepsiru1es92 on October 16, 2009, 09:26:43 PM
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