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.

Removing Template Group and index.php From URL query

June 22, 2007 5:22pm

Subscribe [3]
  • #1 / Jun 22, 2007 5:22pm

    stevo_s

    176 posts

    Hi,

    Just looking at the instructions on this page -

    I just have a query as regards what to replace with my own setup with the .htaccess code below -

    would I just replace the words ‘template_group’ with ‘site’ (the EE default I want to eliminate) ?
    or should it work as is? ( not ready to test just yet)

    RewriteEngine On 
    #Handle comment redirection 
    RewriteCond %{THE_REQUEST} !^POST 
    RewriteRule ^template_group/?(.*)$ /sub_directory/$1 [R=301,L] 
    #Handle removal of index.php and template group from EE URLs 
    RewriteCond %{REQUEST_FILENAME} !-f 
    RewriteCond %{REQUEST_FILENAME} !-d 
    RewriteRule ^(.*)$ /sub_directory/index.php/template_group/$1 [L]


    ( I know some moderators have posted against doing this at all but I am re-designing an existing site and need to keep the url structure, and hey, even EE is doing it on their site, likewise happycog and other users of EE)

  • #2 / Jun 22, 2007 9:04pm

    Derek Jones

    7561 posts

    I would like to step in and for the record state that we are not removing the template group from URLs on our site (nor do we support it), only index.php, and we are not using the catch-all “File and Directory” check method.  Oh, and you know you don’t have to keep the “site” template group, right?

  • #3 / Jun 23, 2007 11:38am

    stevo_s

    176 posts

    I understand it can be changed to another name is that correct, but not totally removed?

    Could you explain why its so bad with EE to NOT have the template group name ?
    Just i’ve got to explain it to a client and they prefer the simple url structure of the existing site like

    http://www.website.com/news/
    http://www.website.com/news/story3.php

    etc,

    and it could muck up bookmarks to sections of the website if it changes.

  • #4 / Jun 23, 2007 11:54am

    Sue Crocker

    26054 posts

    stevo_s, there is a work around.

    You’d need to be running EE 1.6, and using the Pages module.

    EEHowTo:// Pages Test

    Assuming I had a bookmarked page at eehowto.com/news/released.php - I could still see the entry assigned to that “Page” in EE. I have to assign which template group to display, and what the fake url is. In this case, I used /news/released.php which doesn’t actually exist.

    You’d need to make sure that the old sites PHP file is gone.

    Does that help? I’m swallowing index.php, not the template group.

  • #5 / Jun 23, 2007 1:26pm

    Lisa Wess

    20502 posts

    Could you explain why its so bad with EE to NOT have the template group name ?

    There are many reasons for this.  The list here won’t be exhaustive but it will be a quick run-down.

    You will not be able to use the built-in 404 feature.

    ExpressionEngine relies on the URLs to deliver dynamic data based on what you are viewing in the site.  Template groups are assumed to be there and are an important part of how ExpressionEngine delivers the data.  By removing them you will need to be very careful about what you are delivering, where you are delivering it, and how ExpressionEngine knows what to show.  Many of the basic things in EE, like viewing a permanent link, or a category page, may become more finicky. It is certainly possible but you need to have much more understanding of when the template group is used by EE and how to get around it.

    Anyhow, that’s the quick gist of it - the template group is important to EE’s functionality - removing it may cause unforeseen issues, and so I recommend that without advanced knowledge of EE, you do not proceed with that course of action.  Just use a template group name that is informative, and that will be both a boon to your users, and to search engines.

  • #6 / Jun 23, 2007 2:18pm

    stevo_s

    176 posts

    You’d need to be running EE 1.6, and using the Pages module.

    EEHowTo: Pages Test

    Assuming I had a bookmarked page at eehowto.com/news/released.php - I could still see the entry assigned to that “Page” in EE. I have to assign which template group to display, and what the fake url is. In this case, I used /news/released.php which doesn’t actually exist.

    You’d need to make sure that the old sites PHP file is gone.

    Does that help? I’m swallowing index.php, not the template group.

    yep running 1.6
    I don’t quite follow what you did though.
    how have you removed ‘list’ (is that the template name ) from the url?
    is pages module not more for static content?

    Lisa -

    its the template name in the url I guess that is the problem rather than the group name.
    I can have a group called ‘news’ which is fine and makes sense.
    on the ‘news’ homepage there will be a list of story summaries with a link to full story whoses template name is ‘fullstory’
    but I end up with the long url http://www.website.com/news/fullstory/story_name/
    (once I get rid of index.php in urls)
    Just seems to me the template name is irrelevant to those viewing the site and should be hidden.

  • #7 / Jun 23, 2007 4:26pm

    Sue Crocker

    26054 posts

    stevo_s, I haven’t gotten rid of the template group called howto which uses the template called info to deliver via segment_3 a single entry page. What the Pages module does is fake a url called /news/released.php which I’m using to emulate what you needed.

    Pages Doc

    Have you tried installing the Pages module and assigned an existing or new entry to a staticy looking URL.

    The one thing you need to remember is that if you don’t want index.php to appear in the URL, you’ll need to use .htaccess to remove index.php.

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

ExpressionEngine News!

#eecms, #events, #releases