0

I am using the Community Edition and recently started working on Magento on a site that has been live for 3.5 years. I noticed that in Google Analytics, I am getting 2 different results on the CMS Page

"www.baseurl.com/cms-page" and "www.baseurl.com/cms-page/"

I also noticed that the CMS pages do not have a .html like the products, is that normal? Is there a code I can drop into the .htacess to just reroute the URLS from "/cms-page/" to "/cms-page"? Or should I look at an SEO plugin? The CMS pages have interlinks as well that do not have consistency, so before I go in and do everything by hand...

What are the best practices here and best fix? Thank you.

Current Rewrite Rules and Conditions

############################################
## enable rewrites

# For security reasons, Option followsymlinks cannot be overridden.
#    Options +FollowSymLinks
    Options +SymLinksIfOwnerMatch
    RewriteEngine on

############################################
## you can put here your magento root folder
## path relative to web root

    #RewriteBase /magento/

############################################
## uncomment next line to enable light API calls processing

#    RewriteRule ^api/([a-z][0-9a-z_]+)/?$ api.php?type=$1 [QSA,L]

############################################
## rewrite API2 calls to api.php (by now it is REST only)

    RewriteRule ^api/rest api.php?type=rest [QSA,L]

############################################
## workaround for HTTP authorization
## in CGI environment

    RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]

############################################
## TRACE and TRACK HTTP methods disabled to prevent XSS attacks

    RewriteCond %{REQUEST_METHOD} ^TRAC[EK]
    RewriteRule .* - [L,R=405]

############################################
## redirect for mobile user agents

    #RewriteCond %{REQUEST_URI} !^/mobiledirectoryhere/.*$
    #RewriteCond %{HTTP_USER_AGENT} "android|blackberry|ipad|iphone|ipod|iemobile|opera mobile|palmos|webos|googlebot-mobile" [NC]
    #RewriteRule ^(.*)$ /mobiledirectoryhere/ [L,R=302]

############################################
## always send 404 on missing files in these folders

    RewriteCond %{REQUEST_URI} !^/(media|skin|js)/

############################################
## never rewrite for existing files, directories and links

    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteCond %{REQUEST_FILENAME} !-l

############################################
## rewrite everything else to index.php

    RewriteRule .* index.php [L]

</IfModule>
  • Yep, CMS pages without the '.html' at the end are normal. You can add them in to the admin if you like CMS -> Pages -> open specific page -> URL Key, but this isn't really necessary. – Jason Tipton Jan 23 '15 at 18:16
1

Add an .htaccess rule to 301 redirect any page without a trailing slash. The RewriteRule below will exclude html, html, jpg, gif, png and pdf so it won't add a trailing slash where it isn't needed. You can add to the types in the parentheses in the RewriteCond to include more file extensions.

RewriteCond %{REQUEST_URI}  !\.(htm|html|jpg|gif|png|pdf)$
RewriteRule ^(.*)([^/])$ http://%{HTTP_HOST}/$1$2/ [L,R=301]
  • Thank you very much. I will test it tomorrow. Beer time right now. – Sean Scott Jan 24 '15 at 3:42
  • Ok, I did it and I really did not know where to put it. It also sent the urls to the index.php. There are some rewrite rules already in there. I am guessing this is conflicting somewhere. I updated the original question with the current rules that were in there. – Sean Scott Jan 24 '15 at 22:38
  • You should be able to put it at the very bottom of your htaccess – seanbreeden Jan 25 '15 at 0:27
  • when I do that, it sends every link to www.website.com/index.php – Sean Scott Jan 28 '15 at 22:17

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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