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.

MSM - Categories creating URLs on wrong site

March 04, 2011 1:03pm

Subscribe [4]
  • #1 / Mar 04, 2011 1:03pm

    Richard Wiggins

    60 posts

    A bizarre issue has just been raised by a client:

    We have an EE 1.7.0 install with MSM. On the first initial site (http://www.fullsupporthealthcare.com) there are two category groups (Blog and Countries).

    On the second site (http://www.easirange.com) there is only one category group (Products).

    For some reason, Google has started indexing pages/URLs on the second site that shouldn’t exist. These URLs are basically being formed by categories from the first site (Company News, France, Spain etc) e.g:

    http://www.easirange.com/shop/company-news
    http://www.easirange.com/shop/ireland
    http://www.easirange.com/shop/spain

    I don’t know how or why this is happening and for how long, but we need to stop it.

    Any ideas?

  • #2 / Mar 04, 2011 6:10pm

    Sue Crocker

    26054 posts

    Is shop your category indicator for either site?

  • #3 / Mar 05, 2011 11:10am

    Richard Wiggins

    60 posts

    No, it’s set to ‘category’ on both sites.

  • #4 / Mar 06, 2011 2:59pm

    Greg Salt

    3988 posts

    Hi Richard,

    Have you or anybody else used a sitemap.xml file with Google’s Webmaster Tools? Those URLs don’t seem to be indexed in Bing or Yahoo so it suggests a Google specific error of some sort.

    Cheers

    Greg

  • #5 / Mar 07, 2011 5:53am

    Richard Wiggins

    60 posts

    That is quite possible. I’ll check it out.

    I still don’t understand how that category information is showing up on the second site though?

  • #6 / Mar 07, 2011 10:01am

    Sue Crocker

    26054 posts

    I think that’s what we’re trying to find out. 😊

    What is in your shop template? You’re removing index.php too, so that might have something to do with it.

  • #7 / Mar 07, 2011 10:07am

    Richard Wiggins

    60 posts

    Here’s the code from my shop template (split into 2 posts as it wouldn’t fit in one):

    {if segment_3!=""}
        {exp:weblog:entries weblog="products" limit="1" url_title="{segment_3}"}
            {embed="_includes/_header" entry_id="{entry_id}"}
        {/exp:weblog:entries}
    {if:elseif segment_2!="" AND segment_3==""}
        {embed="_includes/_header" title="{exp:query sql="SELECT cat_name FROM exp_categories WHERE cat_url_title = '{segment_2}' LIMIT 1"}{cat_name}{/exp:query} | Products | Healthcare | Medical | Industrial"}
    {if:else}
        {embed="_includes/_header" title="Buy | Products | Healthcare | Medical | Industrial"}
    {/if}
    
    
    <!-- End header -->
        {if segment_3!=""}
            <body class="product">
            {if:else}
            <body>
        {/if}
    <!-- Start nav -->
    {embed="_includes/_nav"}
    <!-- End nav -->
    <!-- Start main content -->
            <div class="container_24 main">
                <!-- Start Left Panel -->
                {embed="_includes/_leftbar"}
                <!-- End Left Panel -->
                <div class="grid_16 suffix_1">
                <!-- Start main page -->             
                    <section>
                        <ul class="breadcrumb">
                            <li class="first">
                                <a href="http://{site_url}">Home</a>
                            </li>
                            {if segment_2==""}
                                <li>
                                    Shop
                                </li>
                            {if:elseif segment_2!="" AND segment_3==""}
                                <li>
                                    <a href="http://{path={segment_1}}">Shop</a>
                                </li>
                                {exp:query sql="SELECT * FROM exp_categories WHERE cat_id = '{segment_2_category_parent_id}' LIMIT 1"}
                                    <li><a href="http://{path={segment_1}/{cat_url_title}}">{cat_name}</a></li>
                                {/exp:query}
                                {exp:query sql="SELECT * FROM exp_categories WHERE cat_url_title = '{segment_2}' LIMIT 1"}
                                    <li>{cat_name}</li>
                                {/exp:query}
                            {if:elseif segment_3!=""}
                                <li>
                                    <a href="http://{path={segment_1}}">Shop</a>
                                </li>
                                {exp:query sql="SELECT * FROM exp_categories WHERE cat_id = '{segment_2_category_parent_id}' LIMIT 1"}
                                    <li><a href="http://{path={segment_1}/{cat_url_title}}">{cat_name}</a></li>
                                {/exp:query}
                                {exp:query sql="SELECT * FROM exp_categories WHERE cat_url_title = '{segment_2}' LIMIT 1"}
                                    <li><a href="http://{path={segment_1}/{segment_2}}">{cat_name}</a></li>
                                {/exp:query}
                                {exp:weblog:entries weblog="products" limit="1" url_title="{segment_3}"}
                                    <li>{title}</li>
                                {/exp:weblog:entries}
                            {/if}
                        </ul>
                        <div class="clear"></div>
                        <!--The Categories Page ///////////////////////////////////////////////////////////////-->
    
                        {if segment_2==""}
                        
                        <header>
                            <h2>Full Support Healthcare Shop Range</h2>
    <p>                    </header><br />
                        <div class="clear"></div><br />
                            <br />
                        {exp:weblog:categories weblog="products" style="linear" parent_only="yes"}<br />
                            <div class="item"><br />
                                <a href="http://{path=shop/{category_url_title}}">_                                <em class="range">View Range</em>_                                {site_url}uploads/{category_image}_                                {category_name}_                            </a><br />
                            </div><br />
                        {/exp:weblog:categories}

  • #8 / Mar 07, 2011 10:08am

    Richard Wiggins

    60 posts

    Second half of shop template:

    <!-- Categories or Products Page ///////////////////////////////////////////////////////////////-->
                        
                        {if:elseif segment_2!="" AND segment_3==""}
                            
                            {exp:query sql="SELECT * FROM exp_categories WHERE cat_url_title = '{segment_2}' LIMIT 1"}
                                <header>
                                <h2>{cat_name}</h2>
    <p>                            </header><br />
                                {if cat_description}<br />
                                    {cat_description}<br />
                                {/if}<br />
                            {/exp:query}<br />
                            <br />
                            <!-- Display a categories list if available --><br />
                            {exp:query sql="SELECT * FROM exp_categories WHERE parent_id = '{segment_2_category_id}' ORDER BY cat_name"}<br />
                                <div class="item"><br />
                                    <a href="http://{path=shop/{cat_url_title}}">_                                    <em class="range">View Range</em>_                                    {site_url}uploads/{cat_image}_                                    {cat_name}_                                </a><br />
                                </div><br />
                            {/exp:query}<br />
                            <br />
                            <!-- Display a product list if available --><br />
                            {exp:query sql="SELECT * FROM exp_categories WHERE cat_url_title = '{segment_2}'"}<br />
                            <br />
                                {exp:weblog:entries weblog="products" category="{cat_id}" orderby="title" sort="asc"}                    <br />
                                    <div class="item"><br />
                                        <a href="http://{title_permalink={segment_1}/{segment_2}}">                                        _                                        {if prod_bcc_value == "icon_value"}_                                            <em class="value">Extra Value</em>_                                        {if:elseif prod_bcc_value == "icon_bcc"}_                                            <em class="bcc">Support Breast Cancer Care</em>_                                        {/if}_                                        <em class="buy">Buy Now</em>_                                        {prod_thumbimage}_                                        {title}_                                    </a><br />
                                    </div><br />
                                {/exp:weblog:entries}<br />
                            <br />
                            {/exp:query}<br />
                            <br />
                        <br />
                        <!--The Single Entry ///////////////////////////////////////////////////////////////--><br />
                        <br />
                        {if:elseif segment_3!=""}</p>
    
    <p>                    {embed="_includes/_proddetails" cat="products"}<br />
                            <br />
                        {/if}<br />
                        <br />
                        <div class="clear"></div><br />
                    </section><br />
                <br />
                <!-- End main page --><br />
                </div><br />
                <div class="clear"></div><br />
            </div><br />
    <!-- End main content --><br />
    <!-- Start footer --><br />
    {embed="_includes/_footer"}

  • #9 / Mar 07, 2011 3:42pm

    Ingmar

    29245 posts

    For some reason, Google has started indexing pages/URLs on the second site that shouldn’t exist. These URLs are basically being formed by categories from the first site (Company News, France, Spain etc) e.g:

    As Greg said, is there perhaps an erroneous sitemap being created?

    You could probably use a 301 redirect for those URL, or perhaps, as a stop-gap measure use a robots.txt file,  something like

    User-agent: *
    Disallow: /shop/
  • #10 / Mar 08, 2011 5:24am

    Richard Wiggins

    60 posts

    For some reason, Google has started indexing pages/URLs on the second site that shouldn’t exist. These URLs are basically being formed by categories from the first site (Company News, France, Spain etc) e.g:

    As Greg said, is there perhaps an erroneous sitemap being created?

    You could probably use a 301 redirect for those URL, or perhaps, as a stop-gap measure use a robots.txt file,  something like

    User-agent: *
    Disallow: /shop/

    I have added disallow methods for items like shop/ireland/ etc

    I can’t do it for /shop/ as that is part of the most URLs used within this secondary site - i.e. the shop site.

    This still doesn’t make sense and it also does not eliminate the following problem:

    If a user somehow goes to a url that doesn’t exist after /shop/ e.g. http://www.easirange.com/shop/fdfsdf, then they are show a page with the categories within the shop site (Coveralls, Drapes, Gowns, Procedure Packs etc), but also the categories from wrong/main site (Company News, Spain, General Blog, UK, Ireland etc).

  • #11 / Mar 08, 2011 9:48am

    Sue Crocker

    26054 posts

    Hi, Richard. Is what they’re being shown your 404 template? Are you trying to use if no_results and require_entry?

  • #12 / Mar 08, 2011 10:22am

    Richard Wiggins

    60 posts

    Hi, Richard. Is what they’re being shown your 404 template? Are you trying to use if no_results and require_entry?

    Hi Sue,

    No, my 404 template is different: http://www.easirange.com/dsadasdasd

    I’m not trying to use no_results and require_entry, but I was using a method to run most shop pages through a single template (shop) and I I’m not calling the results in the standard EE way. Just taken another look at the code and think this is the culprit:

    {exp:query sql="SELECT * FROM exp_categories WHERE cat_url_title = '{segment_2}' LIMIT 1"}
        <header>
        <h2>{cat_name}</h2>
    <p>    </header><br />
        {if cat_description}<br />
            {cat_description}<br />
        {/if}<br />
    {/exp:query}</p>
    
    <p><!-- Display a categories list if available --><br />
    {exp:query sql="SELECT * FROM exp_categories WHERE parent_id = '{segment_2_category_id}' ORDER BY cat_name"}<br />
        <div class="item"><br />
            <a href="http://{path=shop/{cat_url_title}}">_            <em class="range">View Range</em>_            {site_url}uploads/{cat_image}_            {cat_name}_        </a><br />
        </div><br />
    {/exp:query}

    Just need to figure out how to stop that looking at the categories for both sites.

  • #13 / Mar 08, 2011 3:57pm

    Barry Cogan

    291 posts

    Hi Richard,

    You will want to amend your queries to check against site_id and or group_id. Example:

    {exp:query sql="SELECT * FROM exp_categories WHERE cat_url_title = '{segment_2}' AND site_id != 1 LIMIT 1"}

    You will need to put the appropriate id instead of 1. You can get the site_id from the edit sites page (Sites > edit sites)

    I hope this points you in the right direction.

    Best regards,
    Barry

  • #14 / Mar 08, 2011 6:44pm

    Richard Wiggins

    60 posts

    Hi Barry,

    Many thanks. Busy setting up a new machine so I’ll try that in the morning and report back.

  • #15 / Mar 08, 2011 7:13pm

    Barry Cogan

    291 posts

    Will look forward to it!

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

ExpressionEngine News!

#eecms, #events, #releases