I am cleaning up a fairly large site.
Some pages have a trailing slash on the end some don't. Some of the existing backlinks built used a trailing slash in the url and some didn't.
We aren't concerned with picking a particular one but just want to get one set and stick to it from now on.
I am wondering, would I clean this up within the same redirect in the htaccess file that takes care of the www and non www?
example
RewriteEngine On
RewriteBase /
RewriteCond %{HTTP_HOST} ^www.domain.com/ [NC]
RewriteRule ^(.*)$ http://domain.com$1 [L,R=301]
I currently use that to redirect the www. to the non www as you can see. However here is what I was confused about.
Would this code be enough to redirect ALL pages with a / to the ones without?
or would I also need to add another code (so there is 2) to my htaccess like below?
RewriteEngine On
RewriteBase /
RewriteCond %{HTTP_HOST} ^domain.com/ [NC]
RewriteRule ^(.*)$ http://domain.com$1 [L,R=301]
RewriteEngine On
RewriteBase /
RewriteCond %{HTTP_HOST} ^www.domain.com/ [NC]
RewriteRule ^(.*)$ http://domain.com$1 [L,R=301]
That way, now, even the non www pages with a trailing slash will redirect to the non www without the trailing slash.
Hopefully you understand what I am getting at. I just want to redirect EVERYTHING to the non www WITHOUT a /
Thank you
Jake