No announcement yet.

Custom Error page question

  • Filter
  • Time
  • Show
Clear All
new posts

  • Custom Error page question

    After a major update, I had my site set up so that when someone didn't find a page on my site, instead of the error code, they got my sitemap. This way they could find the new page.

    I did not set this up, hostgator did. But they don't seem to do it any longer.

    And a few months ago I noticed that the error page is instead THEIR page. (which takes someone off my site .. and loses them.

    In trying to get hostgator to better explain this page I have not received the "right help".

    Can you help me set it up so that when someone goes to a page that no longer exists, they get my sitemap?

    Thank you.

  • #2
    Really hostgator can do what they like. Your alternative is to try a .htaccess 401 redirect. Which may not work if hostgator sets it. Or you can ask hostgator to change it.


    • #3
      So I'm on the right track in thinking that I'll continue to call HostGator until I find the right person who can do it?!?


      • #4
        Yeah but hosting companies are a pain to get anything done. Most of the time you'll just get a sale rep and not a programmer. I'd try creating the. htaccess file first though.


        • #5
          'cus i'm a lovely lad!

          I've attached a .htaccess file for you.

          if you already have one then you just need to add this part to the bottom of your existing file.

          #first part defines that is for an error
          #second part defines the error number
          #third part is the webpage that should be displayed.
          ErrorDocument 400 /400.html    
          ErrorDocument 401 /401.html
          ErrorDocument 403 /403.html
          ErrorDocument 404 /404.html
          ErrorDocument 500 /500.html
          ErrorDocument 502 /502.html
          ErrorDocument 504 /504.html
          and with php error pages

          ErrorDocument 400 /error-code.php?error=400
          ErrorDocument 401 /error-code.php?error=401
          ErrorDocument 403 /error-code.php?error=403
          ErrorDocument 404 /error-code.php?error=404
          ErrorDocument 500 /error-code.php?error=500
          ErrorDocument 502 /error-code.php?error=502
          ErrorDocument 504 /error-code.php?error=504
          This should be located in your websites root directory.

          or if you use public_html then place it inside there
          Attached Files
          Who needs a Signature?


          • #6
            On a side note you can also use .htaccess to redirect to a sub-directory. For instance if you were running multiple languages on the same server php,asp etc they can run from after specific sub-directories. For instance on my server I have a redirect to /htdocs which runs asp or /jsp which runs jsp


            • #7

              Appreciate the code! Thank you (and you left your fellow countryman coothead in the wind)

              I do have a htaaccess text file.

              1) do I need to change to (for example) 404.html or can I use the page I mentioned above.

              2) I have to go check what each of the error pages mean so that I have the correct pages going to the sitemap page.


              • #8
                Hi maria,

                I'll quote a StackOverflow answer for this one.
                Originally posted by Zistoleon
                Sitemap.xml helps your website to be well and fast indexed. By submitting this file to search engines, I don't see any good reason to ask them to index a page that doesn't exist (404 HTTP status).
                link to source

                I'd imagine you don't need to put these pages in the sitemap
                Who needs a Signature?