Take the 2-minute tour ×
ExpressionEngine® Answers is a question and answer site for administrators, end users, developers and designers for ExpressionEngine® CMS. It's 100% free, no registration required.

How does Google view the redirect tag, e.g:

   {if segment_4 == ""}
        {exp:channel:entries limit="1" entry_id="{segment_3}" disable="categories|category_fields|custom_fields|member_data|pagination"}
            {redirect='forum/answers/{entry_id}/{url_title}'}
        {/exp:channel:entries}
   {/if}

For example I could redirect: site.com/forum/answers/123 to site.com/forum/answers/123/what-is-a-dog and have link rel="canonical" href="{path='{segment_1}/{segment_2}/{segment_3}/{segment_4}'}" on the template.

What will Google make of site.com/forum/answers/123, or will it never see it?

Perplexing...

Thanks.

share|improve this question
add comment

1 Answer

up vote 2 down vote accepted

What will Google make of site.com/forum/answers/123

It will see that as a 302 (temporary) redirect, as that's what EE sends with the {redirect=""} tag (which calls the redirect method of the functions class).

... or will [Google] never see it?

That all depends on where the links to your entries are coming from. If you want your links to appear a certain way, then make sure that the rest of your site links to these entries in that way (i.e., template_group/template/entry_id/url_title), and hence, Google will not have to be redirected (nor will anyone else).

But if you for some reason do not have control over the links which point to these entries, then yes, Google (and everyone else) will trigger that redirect, and the rel="canonical" meta tag should tell Google to remember the correct link (even though it was given a 302 [temporary] rather than 301 [permanent] redirect).

share|improve this answer
    
Fantastic answer, thank you! Primarily I'm considering doing this for seo and flexibility reasons. But I'm torn between only using the url_title in the url or both entry_id and url_title. I've noticed that even on this site, that if you remove the last segment and refresh - that the last segment is returned. Got any advice? –  user1070143 Dec 27 '12 at 23:52
    
I would recommend using both entry_id and url_title instead of just url_title. If you have only the url_title and an admin modifies that url_title, you will not be able to redirect to the proper page for search engines, bookmarks, direct links, etc. If you also have the entry_id (which will not change), you can redirect to the proper location, just like you mentioned on this site (try replacing the last segment on this page with anything; you'll end up back here). Like Derek said, make sure you link to the full path, not just the entry_id with the redirect. –  Jim Butts Dec 28 '12 at 3:02
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.