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.

Friendly URLs and CMS comparison

August 01, 2008 8:01am

Subscribe [2]
  • #1 / Aug 01, 2008 8:01am

    [email protected]

    108 posts

    I am not clear about the proper way to implement friendly url’s for my EE site. I have looked at the wiki and maybe I am missing it but I don’t see a technique that EE endorses?

    their is a disclaimer that this is not endorsed by EE
    http://expressionengine.com/wiki/Remove_index.php_From_URLs/

    The most important thing for me is implementing friendly urls in a way that will work with future versions of EE and follow best practices.

    Could an experienced EE user please direct me to a proper solution and give me a short explanation as to the WHY?

    Thank you,

    Josh

  • #2 / Aug 01, 2008 9:12am

    Ronny

    83 posts

    The most important thing for me is implementing friendly urls in a way that will work with future versions of EE and follow best practices.

    Could an experienced EE user please direct me to a proper solution and give me a short explanation as to the WHY?

    Thank you,

    Josh

    Experienced is a big word, but I’ve been using EE a couple of years now.

    Any EE-url is build with the following segments:

    http://www.somesite.com/template-group/template/entry_title
    Of course you can name any segment exactly as you want. For instance:

    http://www.moviedatabase.com/actors/female/angelina_jolie (just an url I made up!)
    Each actor (Angelina Jolie) will be an entry with it’s own specific entry_title (angelina_jolie). If you want you can change any entry and therefor adjust the last bit of each url for friendly url’s.

    Within each entry you can use custom fields or categories to decide she’s a female. If that’s what you need, you can use your “female”  template you make sure all entries which are marked as female are shown.

    Besides the “female” template, you will probably have another template called “male”. You can list all male actors within this template. For instance: http://www.moviedatabase.com/actors/male/jack_nicholson

    To organize all related templates, you create a template group. In this case it’s called actors. Because that’s what you need. But I can imagine for a moviedatabase you’ll have more template-groups. One might be called movies.

    By using template_groups/templates/entry_titles you are able to create any url structure you want. Just make sure you choose your template_groups and templates wisely.

  • #3 / Aug 01, 2008 10:15am

    Ingmar

    29245 posts

    I am not clear about the proper way to implement friendly url’s for my EE site.

    What’s “friendly” mean to you, exactly? Cause I don’t see anything unfriendly about them.

    Could an experienced EE user please direct me to a proper solution and give me a short explanation as to the WHY?

    Sorry, “why” what, exactly? Why we don’t support the removing of index.php officially?

  • #4 / Aug 01, 2008 12:17pm

    [email protected]

    108 posts

    Ronny and Ingmar,

    To be more clear I want to eliminate the index.php part of the string from my url. Here is an example:

    http://chroniclekitchen.com/index.php/recipes/index/

    I want the url to not include the unnecessary “index.php” part. Otherwise…yes EE url’s are nice I didn’t mean anything more serious than that.

    My question still remains does EE recommend this be done by removing the index.php as indicated in the wiki or by making htaccess modifications? Again I want to do what the EE developers recommend and in the sources I indicated above I was not encouraged one way or the other:

    http://expressionengine.com/docs/installation/renaming_index.html

    http://expressionengine.com/wiki/Remove_index.php_From_URLs/

    Do you recommend one of these methods or is there another way to remove the index.php part from my url string?

    Thank you for your help,

    Josh

  • #5 / Aug 01, 2008 1:05pm

    Ingmar

    29245 posts

    To be more clear I want to eliminate the index.php part of the string from my url.

    Well, I believe you have read the corresponding wiki article? It’s not particularly difficult to do.

    My question still remains does EE recommend this be done by removing the index.php as indicated in the wiki or by making htaccess modifications?

    Isn’t that really the same thing? If you want to remove index.php from your URL (and renaming is not an option for you) you need to use some sort of URL rewriting. In almost all cases this will be done via .htaccess.

    Do you recommend one of these methods or is there another way to remove the index.php part from my url string?

    Both methods are fine. As you see, we remove index.php from this site as well, so we consider it a viable option. We just don’t support it officially because we cannot guarantee it to work on all servers and in all configurations. It is, however, generally safe to do so.

  • #6 / Aug 01, 2008 2:10pm

    Lisa Wess

    20502 posts

    To explain this a bit more; the removal of index.php is not an ExpressionEngine function, but a function of Apache and mod_rewrite.  Some hosts disable mod_rewrite, or parts of it, and that is why we can not guarantee that these methods would always work.

    Just an explanation of why this is and how this works.  It’s a server-level change, really, not a software change.

  • #7 / Aug 01, 2008 3:03pm

    [email protected]

    108 posts

    Thank you I think I am finally getting it and I appreciate the patients of the forum contributors.

    Josh

  • #8 / Aug 01, 2008 5:51pm

    [email protected]

    108 posts

    Well I have been able to remove the index.php from my url string with the instructions in the wiki etc.

    I am running into a problem with a default theme and EE install when it comes to my style sheet loading in properly.

    Like I said the install I am working with is totally default on my local host I have running with MAMP.

    What would cause this? Is there a preference in the admin I need to change?

    Here is the code when I view source:

    <link rel='stylesheet' type='text/css' media='screen' href='http://localhost/stretcher_ee/?css=site/site_css.v.1217648327' />

     

    Here is the code in the *site index template:

    {assign_variable:my_weblog="default_site"}
    {assign_variable:my_template_group="site"}
    
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
    <html >
    
    <head>
    <title>{exp:weblog:info weblog="{my_weblog}"}{blog_title}{/exp:weblog:info}</title>
    <meta http-equiv="Content-Type" content="text/html; charset={charset}" />
    
    <link rel='stylesheet' type='text/css' media='all' href='{stylesheet={my_template_group}/site_css}' />
    <style type='text/css' media='screen'>@import "{stylesheet={my_template_group}/site_css}";</style>
  • #9 / Aug 02, 2008 3:15am

    Ingmar

    29245 posts

    Perhaps this thread can clear things up a little for you.

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

ExpressionEngine News!

#eecms, #events, #releases