ExpressionEngine CMS
Open, Free, Amazing

Thread

This is an archived forum and the content is probably no longer relevant, but is provided here for posterity.

The active forums are here.

404 error if forum url does not exist

February 23, 2011 4:08am

Subscribe [5]
  • #1 / Feb 23, 2011 4:08am

    tiulkin

    26 posts

    Hello.
    How and what I should set in the Forum module to have HTTP 404 error code if requested forum URL does not exist?
    For example:
    I have a forum.mysite.com forum.
    The working URL are http://forum.mysite.com/viewforum/1/
    If user requests http://forum.mysite.com/wrong_url he gets the standard EE window and message without 404 code:

    The following errors were encountered
    The page you requested was not found

    But I would like to have the 404 HTTP code in this case.

    I`ve tried to change “strict url” parameter, but nothing changed.
    Can you help me?

  • #2 / Feb 23, 2011 12:03pm

    Barry Cogan

    291 posts

    Hi tiulkin,

    Have you set up a default 404 page yet?

    You can set a default “404 page” in the “Design” > “Templates” > “Global Template Preferences” section of the Control Panel.

    Best regards,
    Barry

  • #3 / Feb 23, 2011 3:23pm

    tiulkin

    26 posts

    Yes, I`ve set it.But see the other,forum-related page.

  • #4 / Feb 24, 2011 4:27am

    John Henry Donovan

    12339 posts

    tiulkin,

    If user requests http://forum.mysite.com/wrong_url he gets the standard EE window and message without 404 code:

    What 404 code are you expecting? You can put anything you want in this template and make it look like anything you wish. It will still serve with response headers of 404 Not Found

    The following errors were encountered
    The page you requested was not found

    That looks like a browser error. Your are removing htaccess right? Make sure you have added the name of the 404 template into the mix

  • #5 / Feb 24, 2011 5:56am

    tiulkin

    26 posts

    Ok.Let`s begin from start:-)
    I have a forum at http://forum.russianlearn.com
    If somebody trying to access to missing page (f.e. http://forum.russianlearn.com/wrongurl ),he see the error page (see screenshot) with HTTP code 200. I would like to change this HTTP code to 404. This error page is not the same what I point at global templates preferences.I think this setting is not connected with forum error page. I found error_page.html template in the forum theme folder, but i think it is not just for 404 error and I can`t “hardcode” 404 code in it.
    May be for forum module exists other template preferences?

  • #6 / Feb 24, 2011 4:08pm

    Ingmar

    29245 posts

    I have a forum at http://forum.russianlearn.com
    If somebody trying to access to missing page (f.e. http://forum.russianlearn.com/wrongurl ),he see the error page (see screenshot) with HTTP code 200.

    Try using strict urls.

  • #7 / Feb 24, 2011 4:12pm

    tiulkin

    26 posts

    Hello.
    I`ve tried to change “strict url” parameter, but nothing changed.

    See my first post

  • #8 / Feb 24, 2011 4:15pm

    Ingmar

    29245 posts

    Are you using mod_rewrite? Are you running the forums through a regular template? Try doing this, and use “strict parameters”, in which case all requests to an invalid template group should return a 404.

  • #9 / Feb 24, 2011 4:40pm

    tiulkin

    26 posts

    Yes,I use mod_rewrite,I use a regular template, and I get 404 error if I request an invalid template. In case with forum I`m not request wrong template, I`m request rigth template with wrong parameters.
    http://forum.russianlearn.com/wrongurl after rewriting equals http://russianlearn.com/index.php/forums/wrongurl.

  • #10 / Feb 25, 2011 10:57am

    Ingmar

    29245 posts

    So you want http://forum.example.com/wrongurl to throw a 404? In that case you shouldn’t use mod_rewrite at all—or use it to trigger the 404 error. Can you try without url rewriting?

  • #11 / Feb 25, 2011 11:43am

    tiulkin

    26 posts

    But I would not like to back the urls like http://forum.example.com/index.php/forums/.
    I just would like to know which template or setting I should change to have the 404 error on the error page from the screenshot.

  • #12 / Feb 25, 2011 4:21pm

    Barry Cogan

    291 posts

    Hi Tiulkin,

    The template that generates that particular message from the screenshot is:

    Design > Message Pages > User Message

    Styling that will do the trick for you.  You can find out more about this and other templates in our user guide.

    Best regards,
    Barry

  • #13 / Feb 25, 2011 4:42pm

    tiulkin

    26 posts

    Thank you very much,Barry. This is almost what I want.I`ll add some extra code with condition and it should work.
    Best regards,
    Oleg

  • #14 / Feb 25, 2011 4:43pm

    Barry Cogan

    291 posts

    Hi Oleg,

    I am happy to help 😊  Let us know how it turns out for you!

    Best regards,
    Barry

  • #15 / Feb 25, 2011 7:29pm

    tiulkin

    26 posts

    Unfortunatly,looks like this “special” template does not support any tags.
    Will think about other ways.

.(JavaScript must be enabled to view this email address)

ExpressionEngine News!

#eecms, #events, #releases