4

I am using Magento 1.9 and I have a problem with one of my CMS pages. I found out that the page is available under two versions:

  • www.example.com/MyCMSpage

  • www.example.com/MyCMSpage/

I am not sure why the trailing slash at the end of URL is there. The settings under Admin > CMS > Pages > MyCMSpage > Page Information > URL Key is without the /.

Google sees this as two different pages.

How can I solve the problem without damaging the SEO of the page?

I can't add a canonical link to the page with / at the end because it doesn't exist in the admin area, however, is accessible via web and points to the same content as the URL without the /.

Will a 301 redirect solve the problem without any SEO damage?

5
  • You say that the page is available under two URLs ("two versions"), but you also say that the page doesn't exist with the slash. Those two statements contradict each other. What do you actually mean? Commented Oct 15, 2018 at 16:25
  • Hi! Thanks for getting back to me! Sorry for making this unclear. What I meant is, I have created a single CMS page with URL without the trailing slash, however, the page is accessible under both URLs with the same content.
    – Greg
    Commented Oct 15, 2018 at 16:34
  • 2
    So why can't you add the rel canonical meta tag? If you add it to your page, it would appear on both URLs, which is the way that canonical tags are meant to be used. Commented Oct 15, 2018 at 17:19
  • So, the URL with a trailing slash doesn't actually exist anywhere and is not linked to from anywhere? It's just that "it works"?
    – MrWhite
    Commented Oct 15, 2018 at 23:49
  • I think it is something to do with my server configuration, but as google already listed the pages twice I need to make sure only only one will be index by google to avoid duplicate content issue. Also, @StephenOstermiller you are correct, I just added the canonical to one page and it appeared on the other too! Just need to find the core problem now.
    – Greg
    Commented Oct 16, 2018 at 8:42

3 Answers 3

4

Yes, regardless of how this is being added, a 301 redirect of

www.example.com/MyCMSpage/

to

www.example.com/MyCMSpage

should solve the issue without it affecting your SEO. Make sure you get the redirect correct so that you don't end up with a circular redirection.

Note: if the same page is listed twice in Google then Google will view one as duplicate and this could possibly affect the Pagerank of both, particularly if both are being identified as canonical. So, it is definitely worth adding the redirect to resolve this, or at least until you can find the source of the problem.

4
  • 1
    Yes, I managed to add the canonical tag by adding it to the one existing in the admin area (look comments). Also, you are correct, google indexed the page twice resulting with duplicate content issue on one of the best ranking pages on my site. Up-vote from me and accept. I will post my own answer as soon as I find a core problem to the issue. I believe it is something to do with server configuration.
    – Greg
    Commented Oct 16, 2018 at 8:53
  • don't use Magento so couldn't say where the problem lies. but surely if it was a server config issue wouldn't it happen on multiple pages, not just this one?
    – garth
    Commented Oct 16, 2018 at 14:51
  • Yes, it happens on all the CMS pages. I managed to find a permanent solution, see my answer :)
    – Greg
    Commented Oct 16, 2018 at 14:54
  • 1
    yes i saw it and upvoted it. glad to see it has fixed it as expected, however you're probably right about it being in the server config then.
    – garth
    Commented Oct 16, 2018 at 14:56
1

I managed to fix the problem pernamently by adding this to my .htaccess file:

############################################
RewriteCond %{REQUEST_METHOD} ^GET$
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-l
RewriteCond %{REQUEST_URI} !^/downloader.*$
RewriteCond %{REQUEST_URI} ^(.+)/$
RewriteCond %{THE_REQUEST} \s(.+?)/+[?\s]
RewriteRule ^(.*)/$ /$1 [L,R=301] 
############################################

Hope someone finds this useful.

1
  • 1
    This would seem to be "overkill" and far less efficient than it should be. There's no need for the filesystem check to make sure it's not a file (or the symbolic link check - unless you really do have symbolic links that are referenced with a trailing slash) - file system checks are generally considered "expensive". The check against REQUEST_URI (and THE_REQUEST) for the trailing slash are also superfluous, since you are already checking this in the RewriteRule pattern.
    – MrWhite
    Commented Oct 16, 2018 at 15:39
1

I think it is something to do with my server configuration, but as google already listed the pages twice...

it happens on all the CMS pages.

If Google has already found and indexed both URLs then it implies there are links (somewhere) to both - either internal or inbound. Since you state that this "happens on all CMS pages" then it implies it is internal to your site. If the visible in-page links look OK, have you checked your sitemap, RSS feed etc.?

I managed to find a permanent [redirect] solution

This is a Magento issue, not a server one. If this is the case, then implementing a redirect is only a band-aid fix and not ideal if users are finding and navigating via these erroneous URLs (users will be constantly redirected and your access logs will be polluted with 301 redirects - this might, however, give you a clue as to how these URLs are being discovered). You will not be helping search engines by linking to URLs that are being redirected (if that is really what is happening).

To fix this properly you need to find where these erroneous URLs are coming from and fix at source. (Still keep the 301 redirect for SEO, since they have already been indexed.)

This isn't a server issue because...

  • Servers don't magically generate links to your pages.

  • It's not the server that makes these "virtual/CMS" URLs accessible. It would only be the server if these URLs mapped to physical files/directories on the filesystem (in which case the server controls additional pathname information and directory slashes).

    It is the CMS that controls whether "virtual/CMS" URLs (eg. /foo/bar and /foo/bar/) map to the same resource at the time the URL is routed through the CMS. It is the CMS that decides whether to accept or reject one or the other or both. In fact, the CMS needs to take additional steps to ensure this happens.

3
  • If it's happening to all URLS, then in Joomla, Drupal & WordPress this would be most likely be a CMS issue, so @MrWhite is probably correct. Definitely Magento is the first place to look.
    – garth
    Commented Oct 17, 2018 at 4:47
  • Yes, it will be Magento issue, however, the only solution I found so far was the one with redirect. Also, by saying that it happens on all CMS pages, I didn't mean they were index by google but are accessible under two different URLs. Thank you kindly for your response, what you are saying is correct. I will investigate the issue further and try to find a better solution to the problem!
    – Greg
    Commented Oct 17, 2018 at 8:25
  • @BareFeet Ah OK, if it is just that one erroneous URL that is indexed, and you aren't linking to that URL from within your site then maybe a redirect is all you need after all!
    – MrWhite
    Commented Oct 19, 2018 at 0:24

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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