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.

Canonical and unwanted trailing slash

February 25, 2011 1:56pm

Subscribe [5]
  • #1 / Feb 25, 2011 1:56pm

    123454329

    144 posts

    Why is ee writing this code

    <link rel="canonical" href="{page_url}">

    into

    <link rel="canonical" href="http://thomaswinterstetter.com/de/webdesign/">

    And yes, I have no trailing slash in the page_url

    Thank you.

  • #2 / Feb 25, 2011 4:50pm

    Barry Cogan

    291 posts

    Hi Thomas,

    Can you give us the build and version number of your copy of expression engine please.

    Thank you.
    Barry

  • #3 / Feb 25, 2011 5:05pm

    123454329

    144 posts

    barry:
    20101220
    tks!

  • #4 / Feb 26, 2011 5:05pm

    Greg Salt

    3988 posts

    Hi Thomas,

    Please try using page_uri instead.

    Cheers

    Greg

  • #5 / Feb 27, 2011 3:23am

    123454329

    144 posts

    hey greg!

    as expected this is what page_uri outputs:

    <link rel=“canonical” href=”/de/webdesign/”>

    Pls read this:
    http://ellislab.com/forums/viewthread/175436/
    http://ellislab.com/forums/viewthread/161289/

    I understand that adding a trailing slash in EE 2 makes no longer sense - that is why i want to get rid of all unwanted ones!

    **

    Having the config option for “trailing slashes” seems to make sense.

  • #6 / Feb 28, 2011 3:23am

    John Henry Donovan

    12339 posts

    Thomas,

    Can you tell us exactly what you add as the Pages URI under the Pages Tab in this entry? Do you have a trailing slash there?

    Also in your General configuration can you tell us what you have added for the URL to the root directory of your site?

    I can replicate for the {page_url} but not for the {page_uri} where I suspect you may have added that trailing slash in the entry itself. Can you confirm?

  • #7 / Feb 28, 2011 3:56am

    123454329

    144 posts

    john,
    no trailing slashes in either one.
    tks!

  • #8 / Feb 28, 2011 6:46am

    123454329

    144 posts

    john,
    i have further investigated and found you are right about page_uri.

    <link rel="canonical" href="{site_url}{page_uri}">

    outputs indeed

    <link rel="canonical" href="http://thomaswinterstetter.com/de/webdesign/faq">

    i hope we both agree that a viable solution will be page_url rendering this exact result.

    i have found that my homepage (site_url) always has the trailing slash attached and wonder where this trailing slash still slips in from…

    any idea?

    in config.php i have this:

    | Base Site URL
    |--------------------------------------------------------------------------
    |
    | URL to your CodeIgniter root. Typically this will be your base URL,
    | WITH a trailing slash:
    |
    |    <a href="http://example.com/">http://example.com/</a>
    |
    */
    $config['base_url']    = "http://thomaswinterstetter.com/";
    
    /*

    omitting trailing slash seems to have no effect here…

    pls advise!

  • #9 / Feb 28, 2011 4:15pm

    Ingmar

    29245 posts

    So why exactly is using

    <link rel="canonical" href="{site_url}{page_uri}">

    not an option? That said, I’ll try to reproduce that behavior.

  • #10 / Apr 20, 2012 3:53pm

    Shane Eckert

    7174 posts

    Hey all!

    Closing off the thread.

    Cheers,

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

ExpressionEngine News!

#eecms, #events, #releases