WordPress.org

Support

Support » Requests and Feedback » [Plugin: WP Super Cache] Big Problem With Trailing Slash – Create Duplicate Content !!

[Plugin: WP Super Cache] Big Problem With Trailing Slash – Create Duplicate Content !!

Viewing 12 replies - 1 through 12 (of 12 total)
  • Unfortunately Apache automatically adds a slash to directories and since the pages are basically static files that’s what’s happening here. You could try switching to “Half on” mode instead.

    I’m afraid that I didn’t explain very well. Every blog using wp-supercache have this problem. Let’s take an example from your blog (http://ocaoimh.ie/2007/11/03/where-have-all-the-wispas-gone/)

    I do :
    GET /2007/11/03/where-have-all-the-wispas-gone/ HTTP/1.1
    (with trailing slash) and I get:
    HTTP Status Code: HTTP/1.1 200 OK

    Next I do:
    GET /2007/11/03/where-have-all-the-wispas-gone HTTP/1.1
    (without trailing slash) and I get:
    HTTP Status Code: HTTP/1.1 200 OK

    This means that you have 2 pages on your blog with 100% duplicate content.

    Default behavior of wordpress is to 302 redirect the non trailing slash page to the trailing slash one like in the following example (I will use http://www.onlyaphoto.com/conceptual-photography/horse-power/ because this blog is not using wp-supercache:

    GET /conceptual-photography/horse-power/ HTTP/1.1
    returns:
    HTTP Status Code: HTTP/1.1 200 OK

    and
    GET /conceptual-photography/horse-power HTTP/1.1 (without trailing slash)
    returns:
    HTTP Status Code: HTTP/1.1 302 Moved Temporarily
    witch is correct.
    This way, google will never find 2 pages with the same content.

    Please, make your own tests and maybe you can find a fix for this problem. Practically every blog using wp-supercache has this problem.

    Thank you

    hi there,
    would the following additions the rewrite conditions in the .htaccess file solve these problems?

    RewriteCond %{REQUEST_URI} !^.*/$
    RewriteCond %{REQUEST_URI} !^.*//.*$

    in theory this should reject URLs that contain either a missing or multiple trailing slashes, so the user shouldn’t receive a ‘super cached’ page, and wordpress should then handle the 301/302 redirect.

    thanks,
    andy

    as my rewriting skills are a bit lacking, the top line perhaps should be:
    RewriteCond %{REQUEST_URI} !^.*[^/]$

    Andy – good idea. The second rule filters out any url with “//” in the request, doesn’t it? I see that redirects too. Nice job!

    definitelynot – thanks for reporting the problem, and persisting in explaining it!

    Google is very good at figuring out what the real urls of a page are but I’ll add a fix for this. Unfortunately it’s not as simple as adding those two rules because some people actually use urls without trailing slashes, the fiends! 🙂

    This is similar to an issue I brought up a week ago.

    http://wordpress.org/support/topic/196538?replies=7 , it also caches direct IP address access and non www.

    have these 2 issues been fixed? (the slashes and the www/non-www)

    mactac – yes.

    It which version? I just tested mine and it’s not fixed…

    It’s been fixed for some time. See http://ocaoimh.ie/2009/02/10/press-play-on-tape-retro-action – it redirects to the url with the slash at the end.
    http://www.ocaoimh.ie/2009/02/10/press-play-on-tape-retro-action/ redirects and removes the www. using the normal WordPress redirection code.

    Make sure your .htacess rules have these lines. They do the ending slash thing and should have been added automatically. If you changed permalink structure since writing the rules that might be why they’re not there.

    RewriteCond %{REQUEST_URI} !^.*[^/]$
    RewriteCond %{REQUEST_URI} !^.*//.*$

    no, I checked your example:
    http://ocaoimh.ie/2009/02/10/press-play-on-tape-retro-action

    That’s a 302 redirect.

    It’s *not* fixed.

    That’s WordPress. File a bug in trac at http://trac.wordpress.org/ but also check out the recent wp-hackers thread on this. The archives are online somewhere as this was trashed out there too. It’s not a supercache bug. Nothing to do with this plugin at all.

Viewing 12 replies - 1 through 12 (of 12 total)
  • The topic ‘[Plugin: WP Super Cache] Big Problem With Trailing Slash – Create Duplicate Content !!’ is closed to new replies.
Skip to toolbar