Lego2012
9/26/2016 - 9:00 PM

htaccess Trailing Slash

htaccess Trailing Slash

# http://socreativedigital.com/7-htaccess-file-examples-that-work-for-seo-2013-05-04
# After adding the code for clean URL’s I found that some pages had a trailing
# slash at the end of the URL and others did not. The trailing slash denotes a
# directory and those without a trailing slash denote a file. In most cases both
# versions of these URLS’s will have the same content which is a problem for
# search engines as they do not know which one to serve and will see them as
# duplicate content.
#
# There is htaccess code which you can implement in your file which will either
# remove the slash from all URL’s or add the slash. It is your choice as to which
# one you have, and as long as you choose one or the other, again, search engines
# are happy as it resolves the issue of duplicate content. Below is the code to
# remove the trailing slash:
#
RewriteEngine On
RewriteRule ^(.*)/$ http://%{HTTP_HOST}/$1