Trailing slash duplicate content problem

Home Forums BulletProof Security Pro Trailing slash duplicate content problem

Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • #3419
    AITpro Admin
    Keymaster

    Email Question:

    Hello,

    I’ve been using BPS Pro for quite a while and recently we redeveloped our website. I am having a really hard time with trying to figure out why my pages are loading with both trailing slash and without. I was wondering (since you are an htaccess master) if you offer consulting or if maybe there is just a quick fix to make pages like this one: http://example.com/services/web-design/ not also load at: http://exampe.com/services/web-design which is causing duplicate content problems.

    It appears as though the blog works right, as I am using WordPress SEO to force a trailing slash on blog categories, but not posts.

    I also use W3TC which adds another layer to htaccess complexity.

    Any assistance would be so greatly appreciated and I am happy to pay for your time if needed 🙂

    Thank You,

    #3421
    AITpro Admin
    Keymaster

    Google Webmaster Blog Reference:  http://googlewebmastercentral.blogspot.com/2010/04/to-slash-or-not-to-slash.html

    What is your WordPress Custom Permalink Structure setting under:  Settings >>> Permalinks?  Your Custom Structure Tag should look like /%postname%/ with a trailing slash if you are using the postname tag.

    If this is not the problem then you can use this .htaccess code to rewrite / add the trailing slash, but you need to ensure the problem is not originating from your SEO plugin or caching plugin just for good measure because there could be other problems with Tag pages, etc.

    RewriteCond %{REQUEST_URI} !(/$|\.)
    RewriteRule (.*) %{REQUEST_URI}/ [R=301,L] 

    And for WordPress specifically and with a BPS / BPS Pro root .htaccess file you would need to make this root .htaccess file coding modification.

    NOTE:  If you make this modification/change then DO NOT Activate BulletProof Mode again since it will overwrite this custom .htaccess code modification that you have made.

    Find this .htaccess code in your Root .htaccess file….

    ...
    ...
    ...
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule . /index.php [L]

    …and modify/change it to this…

    RewriteCond %{REQUEST_FILENAME} !-f
    #RewriteCond %{REQUEST_FILENAME} !-d
    #RewriteRule . /index.php [L]
    RewriteCond %{REQUEST_URI} !(.*)/$
    RewriteRule ^(.*)$ <a href="#" rel="nofollow">http://domain.com/$1/</a> [QSA,L,R=301]

    -d‘ (is directory)
    Treats the TestString as a pathname and tests whether or not it exists, and is a directory.

    -f‘ (is regular file)
    Treats the TestString as a pathname and tests whether or not it exists, and is a regular file.

Viewing 2 posts - 1 through 2 (of 2 total)
  • You must be logged in to reply to this topic.