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.

Enable Strict URLs blank page

August 30, 2010 11:50pm

Subscribe [4]
  • #1 / Aug 30, 2010 11:50pm

    grrramps

    2219 posts

    I’ve set up Enable Strict URLs to Yes. The 404 page is a specific template. However, when a bad URL is entered, I receive a blank white page, instead of the error template page.

    http://mysite.com/index.php/laksdjflskjdf

    Results in a blank white page instead of the error template.

    The 404 page is /template-group/error

    Is there a trick to getting that set up that I’m missing?

    EE 1.6.9 20100805

  • #2 / Aug 31, 2010 3:49pm

    Ingmar

    29245 posts

    Do you’ve got a link? Are you using mod_rewrite / .htaccess in any way? Have you tried to enable PHP errors?

  • #3 / Aug 31, 2010 4:12pm

    grrramps

    2219 posts

    Do you’ve got a link? Are you using mod_rewrite / .htaccess in any way? Have you tried to enable PHP errors?

    Check these:

    1 - Regular link to entry with index.php, template-group, template, entry

    2 - Broken link to a non-entry with index.php, template-group, template, gibberish (not an entry)

    3 - Broken link to non-entry with index.php, wrong template-group name, wrong template name, gibberish entry name (not an entry)

    Not using mod_rewrite in .htaccess to remove index.php. Not seeing any PHP errors. With debugging on the string says 404 page is showing but it is not (see image enclosed). I’m using a number of path variables—does that make a difference?

    #1 returns the entry appropriately and as expected.
    #2 returns to the most recent entry.
    #3 returns a blank white page (no code).

    Whatever is happening the 404/error template does not display. I’ve verified this on a couple of other EE 1.6.9 installs. I suspect it is related to the path variables.

  • #4 / Sep 01, 2010 3:14am

    John Henry Donovan

    12339 posts

    grrramps,

    What the direct link to your 404 please?

    Are you using the require_entry=“yes” parameter along with the no results conditional?

    {if no_results}
    {redirect="/template-group/error"}
    {/if}


    If not can you give that a go please

    What are you using the path variables for, anything unusual or just standard use?

  • #5 / Sep 01, 2010 3:29am

    grrramps

    2219 posts

    What the direct link to your 404 please?

    Try this.

    The 404/error page is a quick redirect back to the home page.

    Are you using the require_entry=“yes” parameter along with the no results conditional?

    No, not using either of those conditionals. Should I?

    {if no_results}
    {redirect="/template-group/error"}
    {/if}

    If not can you give that a go please

    Where would I put it?

    What are you using the path variables for, anything unusual or just standard use?

    Nothing special. Items like these from the path.php variable array:

    weblog=”{my_channel_name}”

    href=”{title_permalink={my_template_group}/articles}”

  • #6 / Sep 01, 2010 11:11am

    Ingmar

    29245 posts

    #2 returns to the most recent entry.

    That is expected. You can use the require_entry parameter to change this behavior.

    #3 returns a blank white page (no code).

    When you take a look at the source code, is it empty, too? None of these links show to me for some reason (using Chrome 6.0.453.1 dev) but the source code is there. I suspect some JS issues.

  • #7 / Sep 01, 2010 11:13am

    Ingmar

    29245 posts

    The direct link to your 404 shows me a blank page, with this in the source:

    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> 
    <html > 
    <head> 
    <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1" /> 
    <meta http-equiv="refresh" content="2; url=http://noodlemac.com/"> 
    <title>NoodleMac | Error 404 - Page Not Found</title> 
    <style type="text/css"> 
    * {
        padding: 0;
        margin: 0;
    }
     
    html {
        height: 100%;
        margin-bottom: 1px;
    }
     
    body {
        background: #3f4d5a;
    }
    </style> 
    </head> 
    <body> 
    </body> 
    </html>

    After 2 seconds it redirects to the homepage, but that seems to be intended behavior.

  • #8 / Sep 01, 2010 1:44pm

    grrramps

    2219 posts

    The direct link to your 404 shows me a blank page, with this in the source:

    After 2 seconds it redirects to the homepage, but that seems to be intended behavior.

    Yes, that’s the intended behavior (working on a pretty 404).

  • #9 / Sep 01, 2010 1:49pm

    grrramps

    2219 posts

    #2 returns to the most recent entry.

    That is expected. You can use the require_entry parameter to change this behavior.

    Where does that parameter go?

    #3 returns a blank white page (no code).

    When you take a look at the source code, is it empty, too? None of these links show to me for some reason (using Chrome 6.0.453.1 dev) but the source code is there. I suspect some JS issues.

    Yes, source code is empty. Links above show up in Chrome 6.0.x Mac, and Safari.

    The objective is to put some consistency in 404s and redirects. Bad URLs into EE don’t behave the same as bad non-EE URLs.

  • #10 / Sep 01, 2010 6:00pm

    Brandon Jones

    5500 posts

    Hi grrramps,

    The require entry parameter is used on the exp:weblog:entries opening tag, and you can put the

    {if no_results}
    {redirect="/template-group/error"}
    {/if}

    anywhere between its opening and closing tags, though it’s generally put right after the opening tag. Does that work?

  • #11 / Sep 01, 2010 6:37pm

    grrramps

    2219 posts

    ...anywhere between its opening and closing tags, though it’s generally put right after the opening tag. Does that work?

    Nope. Same blank white page.

    This URL: http://mysite.com/index.php/lskjfslkfjsdlkfj yields a blank white page.

    This URL: http://mysite.com/index.php/template_group/lskjfdlsfjslkdf yields the site’s default home page (expected behavior?).

    This URL: http://mysite.com/lskjdflskfjslkdfj yields the site’s default 404 file not found error page (which, for now, then redirects to the home page)

    EE’s default Strict URL error page is never displayed (/template-group/error), though it’s turned on.

  • #12 / Sep 02, 2010 4:11am

    John Henry Donovan

    12339 posts

    grrramps,

    This URL: http://mysite.com/index.php/lskjfslkfjsdlkfj yields a blank white page.

    This however is giving 404 response headers. Not quite sure what is up here yet.

    Can you share you weblog:entries tag please?

    Can you also add the parameter url_title=”{segment_3}” to it just as a test

  • #13 / Sep 02, 2010 11:45pm

    grrramps

    2219 posts

    Can you share you weblog:entries tag please?

    Nothing special here:

    exp:weblog:entries weblog=”{mysite_channel_name}” limit=“1” dynamic=“on”  show_future_entries=“yes” disable=“trackbacks|member_data|category_fields|pagination”}

    Links typically look this way:

    href=”{url_title_path={mysite_template_group}/comments}#post”

    Can you also add the parameter url_title=”{segment_3}” to it just as a test

    What is that and where does it go?

    One other question. Are my expectations of what Strict URLs should do correct? If the URL entered is http://mysite.com/index.php/lskjdlskjdf, the page presented should be the default error page, right?

  • #14 / Sep 03, 2010 3:03am

    John Henry Donovan

    12339 posts

    grrramps,

    What is that and where does it go?

    The url_title= is a parameter for the weblog:entries tag. It allows you to limit the query by an entry’s url_title. That entry’s URL title appears typically in segment 3 of your URL.

    You would add it to the weblog:entries tag like so

    {exp:weblog:entries weblog="news" limit="1" url_title="{segment_3}" require_entry="yes"}
    {if no_results}
    {redirect="/template-group/error"}
    {/if}  
    <h1>{title}</h1>
    {/exp:weblog:entries}

    {segment_3} references that third segment. You can read more about URL Segment Variables here


    Enabling Strict URLs requires that the first URL segment be a valid template group, or a 404 page is shown.So typically yes, entering garbage for first segment should give you a 404

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

ExpressionEngine News!

#eecms, #events, #releases