Koozali.org: home of the SME Server

How to Modify 404 Page Not Found Page?

Offline arnoldob

  • *
  • 183
  • +0/-0
How to Modify 404 Page Not Found Page?
« on: August 06, 2004, 02:17:00 AM »
Anybody know where the 404 error page is stored? I'd like to modify it.

Thanks?
Tampa, FL USA

murmele

How to Modify 404 Page Not Found Page?
« Reply #1 on: August 06, 2004, 02:39:52 AM »
hi, i suppose it is your browser talking to you,

peter

Offline mrjhb3

  • *
  • 1,188
  • +0/-0
    • John Bennett Services
How to Modify 404 Page Not Found Page?
« Reply #2 on: August 06, 2004, 06:36:32 AM »
You can modify it by added something like this to your httpd.conf file.

ErrorDocument 404 /errordocs/filenotfound.html

This tells apache to redirect all 404 errors to this file.  This would be located at /home/e-smith/files/ibays/Primary/html/errordocs

Make sure to test, then create a templates-custom template to make your changes permanent.

good luck,

JB
......

Offline byte

  • *
  • 2,183
  • +2/-0
How to Modify 404 Page Not Found Page?
« Reply #3 on: August 06, 2004, 08:56:33 AM »
Try searching I have answered this many times in past... :hammer:
--[byte]--

Have you filled in a Bug Report over @ http://bugs.contribs.org ? Please don't wait to be told this way you help us to help you/others - Thanks!

Offline arnoldob

  • *
  • 183
  • +0/-0
How to Modify 404 Page Not Found Page?
« Reply #4 on: August 06, 2004, 03:29:49 PM »
I found a couple of threads that refered to another thread, but the instructions were from 2002, and I believe incompatable with the later template tree. I played with one post lastnight, then got annoyed and gave up. I'll do some reading about the differences and try again.

If you have a lot of experience doing it, maybe you could submit a formal How-to?

Thanks for the reply
Tampa, FL USA

Offline byte

  • *
  • 2,183
  • +2/-0
How to Modify 404 Page Not Found Page?
« Reply #5 on: August 06, 2004, 03:39:32 PM »
Hi Arnold

Are you trying to display 404 so if external person connects to your website they will get your custom error?!?

Or are you meaning the 404 displayed when a user trys to access a website and gets back the ACCESS DENIED PAGE?!?

If your doing the internal one then see if this works for you http://forums.contribs.org/index.php?topic=21587.0
--[byte]--

Have you filled in a Bug Report over @ http://bugs.contribs.org ? Please don't wait to be told this way you help us to help you/others - Thanks!

Offline arnoldob

  • *
  • 183
  • +0/-0
How to Modify 404 Page Not Found Page?
« Reply #6 on: August 06, 2004, 04:28:01 PM »
I should have been clearer. I want to customize the 404 error page served when someone external to my network tries to get a page that doesn't exist. Specifically I moved some stuff around in my Primary ibay (yeah, I know now that's a very bad idea) and I want to offer links to what is most requested. I could write a redirect for each moved page but there were a lot of them so I thought I could offer links to the top level page for each of 3 main catagories of stuff via a custom 404 error page. Is that clearer or did I just confuse things further? :)

Thanks for the reply
Tampa, FL USA

Offline arnoldob

  • *
  • 183
  • +0/-0
How to Modify 404 Page Not Found Page?
« Reply #7 on: August 06, 2004, 10:06:28 PM »
In order to change the 404 page not found displayed to external web browsers on a SME 6.01 box this is what I did:

1. Made a directory for the template fragment:
mkdir -p /etc/e-smith/templates-custom/etc/httpd/conf/httpd.conf

2. Created a template fragment in the above directory.
cd /etc/e-smith/templates-custom/etc/httpd/conf/httpd.conf
pico 11ErrorDocs

3. I added these lines to the 11ErrorDocs file with pico or whatever text editor you like:
ErrorDocument 500 /filenotfound.html
ErrorDocument 404 /filenotfound.html
ErrorDocument 401 /filenotfound.html
ErrorDocument 403 /filenotfound.html
ErrorDocument 402 /filenotfound.html

Save and close. You can do just one of those errors or any combination you like. You can name the html file whatever you like, or use php files if you prefer. You can also specify a different filename for each error type. Just make sure the filename(s) are used in the next step. You can also place them in a sub-directory, just make sure you use an absolute path to whatever file you are using in the 11ErrorDocs template fragment.

4. Created my custom 404 page and named it filenotfound.html and placed it in:
/home/e-smith/files/ibays/Primary/html

5. Expanded the template
/sbin/e-smith/expand-template /etc/httpd/conf/httpd.conf

6. Restarted the http server
/etc/rc.d/init.d/httpd graceful

See this thread:
http://forums.contribs.org/index.php?topic=17159.0

I also understand you can use Nightspirit's .htaccess contrib found here for the same effect:

http://mirror.contribs.org/smeserver/contribs/nightspirit/e-smith-htaccess/

Just install the rpm, then create your .htaccess file in /home/e-smith/files/ibays/Primary/html/ with the same lines as in the 11ErrorDocs template fragment in step 3.
If you place the .htaccess someplace other than the ibay root it will only serve the custom error page for files not found in that sub-directory. If it's in the root I believe it works for all errors referenced in .htaccess in that ibay (or other error types listed in your .htaccess). I did not extensively test that point, so you result may vary :)
Create your custom error pages as above in step 4. Skip step 5 as no template changes are needed.
Do chmod -644 .htaccess from the Primary ibay root. Then restart apache as in step 7. I tried this and it worked as well. I went with the template method based on Charlie Brady's input in that thread I cited above.

Happy Customizing!

Don't you love it when all the pieces come together?
 :pint:
Tampa, FL USA

Offline xboxer21

  • ***
  • 60
  • +0/-0
404 Not found for SME 7
« Reply #8 on: October 08, 2005, 07:35:21 AM »
Hi,
Is there a How to for SME 7

Thanks
......

Offline xboxer21

  • ***
  • 60
  • +0/-0
Resolved
« Reply #9 on: October 10, 2005, 08:36:50 PM »
I followed the same steps suggested by arnoldob and it worked.

Thanks
......