prevent double content startpage

Discussions and requests related to new CMSimple features, plugins, templates etc. and how to develop.
Please don't ask for support at this forums!
Post Reply
svasti
Posts: 1659
Joined: Wed Dec 17, 2008 5:08 pm

prevent double content startpage

Post by svasti » Sat Feb 28, 2015 6:28 pm

http://www.mysite.com and
http://www.mysite.com?start (or whatever the first page is called)
have the same content. I guess that's doublicate content which is not liked by Google.
What about automatic redirection to http://www.mysite.com when $s == 0

Holger
Site Admin
Posts: 3470
Joined: Mon May 19, 2008 7:10 pm
Location: Hessen, Germany

Re: prevent double content startpage

Post by Holger » Sat Feb 28, 2015 6:34 pm

... and maybe a solution for
http://example.com vs. http://www.example.com
as a built-in feature?

[Edit] Ah, there was already a "canonical" - plugin. But it seems it is not compatible anymore :lol: .

cmb
Posts: 14225
Joined: Tue Jun 21, 2011 11:04 am
Location: Bingen, RLP, DE
Contact:

Re: prevent double content startpage

Post by cmb » Sat Feb 28, 2015 6:56 pm

svasti wrote:http://www.mysite.com and
http://www.mysite.com?start (or whatever the first page is called)
have the same content. I guess that's doublicate content which is not liked by Google.
What about automatic redirection to http://www.mysite.com when $s == 0
If I remember correctly, we have discussed this topic not long ago in another thread. I'll try to look it up, if noone beats me to it.
Holger wrote:... and maybe a solution for
http://example.com vs. http://www.example.com
as a built-in feature?
Um, really? Isn't that such a common thing, that it should be handled by the control panel, or .htaccess or whatever the webserver/-space allows? Anyhow, the issue has been discussed not long ago, and at least there is a .htaccess based solution somewhere in the forum, if not already in the XH-Wiki.
Holger wrote:Ah, there was already a "canonical" - plugin. But it seems it is not compatible anymore :lol: .
Really!? It was the only plugin left that still worked with CMSimple_XH when I checked all ge-webdesign.de plugins a while ago. Might have changed in the meantime. Anyway, in my opinion ge_canonical is insufficient to solve the problem of canonical links generally.
Christoph M. Becker – Plugins for CMSimple_XH

Holger
Site Admin
Posts: 3470
Joined: Mon May 19, 2008 7:10 pm
Location: Hessen, Germany

Re: prevent double content startpage

Post by Holger » Sat Feb 28, 2015 7:16 pm

cmb wrote:Um, really?
Why not? If there'll be a redirect for the startpage it could be done with the same line of code.
But you're right. It could be easily handled another way. But I'm not sure if every user is aware about that issue. But that's not our mission...
cmb wrote:Really!? It was the only plugin left that still worked with CMSimple_XH when I checked all ge-webdesign.de plugins a while ago.
Not checked it. Was just meant as a joke ;) .

svasti
Posts: 1659
Joined: Wed Dec 17, 2008 5:08 pm

Re: prevent double content startpage

Post by svasti » Sat Feb 28, 2015 7:25 pm

cmb wrote:we have discussed this topic not long ago in another thread.
yes, but it somehow didn't make it unto the roadmap. The suggestion given, if I remember correctly, was to use .htaccess. While this is works, it seems to me that it also could be done on the cms level.
.htaccess is always something additional, often complicated, and you have to check that it works. And if you change the name of the start page, the .htaccess has to be changed too. Besides you'd need another different .htaccess for every secondary language. Wouldn't it simplify things to implement this?
Holger wrote:Ah, there was already a "canonical" - plugin.
Christoph's Sitemapper does the job for me. And Google doesn't mind it seems.

cmb
Posts: 14225
Joined: Tue Jun 21, 2011 11:04 am
Location: Bingen, RLP, DE
Contact:

Re: prevent double content startpage

Post by cmb » Sun Mar 01, 2015 1:45 am

There are actually three similar issues:
  1. http://www.example.com vs. http://example.com/
  2. http://example.com/ vs. http://example.com/index.php
  3. http://example.com/ vs. http://example.com/?Welcome
(2) is already on the roadmap for XH 1.7 (redirect /index.php -> / to CMSimple_XH). A .htaccess based solution for (1) was also discussed in this thread. It still seems to me that we discussed (3), but I can't find the thread.

Anyhow, it might be sensible to keep these three concerns apart, i.e. discuss them in separate threads/have separate votes.
svasti wrote:What about automatic redirection to http://www.mysite.com when $s == 0
Something like that might be done, unless the user is in admin mode (to avoid "No page selected"). The following draft immediately after rfc() seems to work:

Code: Select all

if (!XH_ADM && $s === 0) {
    $i = preg_replace('/^[^&]*(&|$)/', '$1', $_SERVER['QUERY_STRING']);
    $j = 'Location: ' . CMSIMPLE_URL;
    if ($i) {
        $j .= '?' . $i;
    }
    header($j);
    exit;
} 
Minor issue: after login from the start page we get "No page selected".

Bigger issue: a "302 Moved Temporarily" doesn't help against duplicate content, so a "301 Moved Permanently" is appropriate. That would be fine, as long as the user doesn't replace the first page (I've seen that, where a user had wanted to temporarily stress an important announcement). If that happens, one wouldn't be able to access the former start page via a bookmark (think Google) as long as the cache is not refreshed. It appears that we need some (preferably most effective) cache-control in addition.

Subtle issue: a plugin might rely on $s being correctly set during (plugin) loading (think pagination on the start page), so the automatic relocation would substitute a potential (presumably minor) backward compatibility break.

I would be happy, if somebody will sponsor (in the sense of taking over, push through) this improvement.
Christoph M. Becker – Plugins for CMSimple_XH

maeg
Posts: 525
Joined: Fri Feb 20, 2009 2:27 pm
Location: Agerbæk, Denmark
Contact:

Re: prevent double content startpage

Post by maeg » Sun Mar 01, 2015 7:19 am

Holger wrote:... and maybe a solution for
http://example.com vs. http://www.example.com
as a built-in feature?
+1

cmb wrote: Really!? It was the only plugin left that still worked with CMSimple_XH when I checked all ge-webdesign.de plugins a while ago. Might have changed in the meantime. Anyway, in my opinion ge_canonical is insufficient to solve the problem of canonical links generally.
If Think the sitemapper_xh have A canonical option too

cmb
Posts: 14225
Joined: Tue Jun 21, 2011 11:04 am
Location: Bingen, RLP, DE
Contact:

Re: prevent double content startpage

Post by cmb » Sun Mar 01, 2015 12:19 pm

svasti wrote:
Holger wrote:Ah, there was already a "canonical" - plugin.
Christoph's Sitemapper does the job for me. And Google doesn't mind it seems.
maeg wrote:
cmb wrote:Really!? It was the only plugin left that still worked with CMSimple_XH when I checked all ge-webdesign.de plugins a while ago. Might have changed in the meantime. Anyway, in my opinion ge_canonical is insufficient to solve the problem of canonical links generally.
If Think the sitemapper_xh have A canonical option too
Sitemapper's canonical_hostname option is only a workaround to generate the desired URLs (with or without www) in the XML sitemap. It does not add any canonical links to the HTML, so it is generally insufficient to eliminate duplicate content.

Anyway, solving the http://www.example.com vs http://example.com issue with a canonical link is suboptimal. It's much better to establish a "301 Moved Permanently" redirect from the www subdomain to the domain or vice versa.
Christoph M. Becker – Plugins for CMSimple_XH

Post Reply