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.

Enabling Strict URLs and channel issue

May 29, 2013 4:45pm

Subscribe [2]
  • #1 / May 29, 2013 4:45pm

    CMG Dev

    28 posts

    Hi there,

    When I enable Strict URLs it will prevent to display news from news channel generated by a template below (I’m getting 404 Page Not Found):

    {if segment_2 == ''}
                         {exp:channel:entries channel="news"}
                            <h1 class="orange">{title}</h1>
                            {news_summary}
                            <a href="/index.php{page_uri}">Read more</a>
          
    
    
    
    
                         {/exp:channel:entries}
                    {if:else}
                         {exp:channel:entries channel="news"}
                            <h2 class="bigorange">{title}</h2>
                            {news_body}
                            <a href="/index.php/nm">Back to news</a>
                         {/exp:channel:entries}
                    {/if}

    Any tips how to get this fixed?

     

  • #2 / May 30, 2013 12:15pm

    CMG Dev

    28 posts

    Well - it looks like it is related to the template rather than channel.

    I have a template named news_temp and when I try to use http://www.mydomain.com/news/ it gave me 404 instead reading data from news_temp

    Any clue?

    Thanks

  • #3 / May 30, 2013 12:50pm

    Boyink!

    5011 posts

  • #4 / May 30, 2013 12:55pm

    CMG Dev

    28 posts

    Same - 404

  • #5 / May 30, 2013 12:58pm

    Boyink!

    5011 posts

    So if you are viewing that template, and hit the “View Template” button, it 404’s? 

    Does it work if you remove the top conditional?

    Are you trying to create one template that shows both the index view and detail view?

  • #6 / May 30, 2013 1:04pm

    CMG Dev

    28 posts

    Correct - when I want to preview template it return 404 and it goes to strange URL with /site/news instead /news

    Here you have the site with strict URLs disabled:
    http://www.childrensmedgroup.com/index.php/nm/

    and here with strict URLs enabled:
    http://www.childrensmedgroup2.com/index.php/nm/

  • #7 / May 30, 2013 1:07pm

    Boyink!

    5011 posts

    any .htaccess rules in place?

    Is the path the erroring site rendering correct (all site urls etc appropriate?)

    Did you try removing the conditional

    Do you have a firm understanding of what the Strict URL setting does, and how EE works with URLs?

    I’d suggest inspecting the general config area to see where that /site/ segment is coming from.

  • #8 / May 30, 2013 1:16pm

    CMG Dev

    28 posts

    htaccess file:

    <IfModule mod_rewrite.c>
            RewriteEngine On
    
            # Removes index.php from ExpressionEngine URLs
            RewriteCond $1 !\.(gif|jpe?g|png)$ [NC]
            RewriteCond %{REQUEST_FILENAME} !-f
            RewriteCond %{REQUEST_FILENAME} !-d
            RewriteRule ^(.*)$ /index.php/$1 [L]
    </IfModule>


    I know how EE works with URLs and what are strict URLs. Part of that site is pure CI 😉

    There is nothing with /site in the General Configuration. It looks like some kind of leftover from EE upgrade from 1.7.x to 2.5.x :\

  • #9 / May 30, 2013 1:33pm

    Boyink!

    5011 posts

    I’d pull the htaccess, turn on the output profiler/template debugger etc.

    That site segment is the issue I think - gotta figure out where that is. Check your config file too.

  • #10 / May 30, 2013 1:45pm

    CMG Dev

    28 posts

    OK, found from where /site is coming up on template previews. All those templates are in the ‘site’ template group.

    Is it possible to move ‘news’ template from that group somewhere “outside”?

  • #11 / May 30, 2013 1:46pm

    Boyink!

    5011 posts

    You can choose to copy an existing template when you create a new one.

  • #12 / May 30, 2013 1:52pm

    CMG Dev

    28 posts

    Edit: ‘site’ template group is a default group, so it shouldn’t matter. Also cannot find any option to move a template “outside” of any group.

  • #13 / May 30, 2013 1:56pm

    Boyink!

    5011 posts

    What shouldn’t matter? 

    Sorry I misunderstood - I thought you had a template group called ‘outside’.

    All templates need to live in template groups.

    If you run strict URLs the template group names need to be valid and in the URL.

  • #14 / May 30, 2013 2:30pm

    CMG Dev

    28 posts

    I think when you have ‘site’ template group as a default group it shouldn’t matter to have it in the URL like

    http://www.childrensmedgroup2.com/index.php/site/meet_us/

    vs

    http://www.childrensmedgroup2.com/index.php/meet_us/

    it always should to search for a template in that default group.

    Am I correct?

    But look at that:

    http://www.childrensmedgroup2.com/index.php/site/nm/

    vs

    http://www.childrensmedgroup2.com/index.php/nm/

  • #15 / May 30, 2013 2:31pm

    Boyink!

    5011 posts

    If you have strict urls turned on then yes. If not, then no.

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

ExpressionEngine News!

#eecms, #events, #releases