Should I switch from trailing slash to no trailing slash?
-
I have a website which has had trailing slashes added to the URLs by 301 redirects for over 3 years. However, the custom CMS does not allow navigation links to have trailing slashes. This is resulting in 301s every time a user clicks a navigation link.
The site ranks fairy well for some moderately competitive keywords.
If you were in my shoes, would you remove the forced trailing slash redirect in the .htaccess and replace it with a trailing slash removal redirect, or would you leave it like it is?
Thanks,
Jamesp.s. the CMS also doesn't allow canonicals.
-
I'd absolutely agree. If you can get it fixed properly in a couple of months, then leaving the status quo would e better than making interim changes that just trade one set of redirects for another.
P.
-
Hi Paul, that would be the ideal fix. Unfortunately, it won't be an option for at least a couple of months. Maybe best just to wait then.
-
Honestly? I'd spend the time to get the Custom CMS fixed to allow trailing slashes in the navigation links. That would eliminate the redirect issue, Instead of just trading it off to another set of links that would have to redirect.
It sounds like a code sanitising issue in the CMS. Worth spending a couple of hundred dollars to fix the root cause of the issue instead of spending that money to apply bandaids that cause other problems elsewhere. (And bonus, maybe you can get proper canonicalisation built at the same time.)
Of course, yea, this does depend on having/finding a competent developer and having a test environment that doesn't endanger the live site.
Any chance you could push for this option?
Paul
-
Hi James
The reality is that it doesn't matter whether there is a trailing slash or not at the end of your URLs. What is important is that only one version is used and preferably there is no 301 from one to the other if it can be avoided. Especially if there are live links going to one or the other on the front end of your website.
So in your case you have navigation links with no trailing slash and a forced 301 adding them on.
I would remove the htaccess code which is forcing everything to a trailing slash and then add a piece of code removing it from any inbound requests.
Clearly, all backlinks will include the slash including Google - adding the code will resolve these pretty quickly and your existing search results will flick over when they are next crawled. This will depend on the size of your website and the crawl rate. You can check this in webmasters.
Remember that if you do this the backlinks from other websites will have a trailing slash and when the hits come in the new 301 will take them to a non-trailing slash. There may be a small drop in link juice from these backlinks. (I say 'maybe' as Rand Fishkin still believes so - others swear blind there isn't) so be prepared.
You have to balance this small backlink problem with actively pointing to URLs that 301s that redirect. Any SEO will tell you that this is not good! Presumably, the sitemaps don't have trailing slashes? So your site says one thing and your sitemaps another - a nightmare.
This is a version of the code to be placed at the top:
RewriteEngine On
RewriteCond%{REQUEST_FILENAME}!-d
RewriteRule^(.*)/$ /$1 [L,R]# <- for test, for prod use [L,R=301]I hope that helps
Regards
Nigel
-
Hi James,
Really sorry to hear about your problem, this kind of situation can be a real pain in the neck. If I were you, I would look for a better CMS which gives me a freedom to do a better SEO. If you still wish to continue with this CMS, you should map 301 the URLs for trailing slashes to their working locations.
I hope this helps.
Regards,
Vijay
Got a burning SEO question?
Subscribe to Moz Pro to gain full access to Q&A, answer questions, and ask your own.
Browse Questions
Explore more categories
-
Moz Tools
Chat with the community about the Moz tools.
-
SEO Tactics
Discuss the SEO process with fellow marketers
-
Community
Discuss industry events, jobs, and news!
-
Digital Marketing
Chat about tactics outside of SEO
-
Research & Trends
Dive into research and trends in the search industry.
-
Support
Connect on product support and feature requests.
Related Questions
-
Trailing Slash and Non-Trailing Slash Inconsistency
Hi, Majority of the URLs on the site I'm working on are using non-trailing slash, https://example.com/page1
Intermediate & Advanced SEO | | nerdieb
https://example.com/page2
https://example.com/page3 But when it comes to the blog pages, they are using trailing slash: https://example.com/blog/specific-blog-post1/
https://example.com/blog/specific-blog-post2/
https://example.com/blog/specific-blog-pos3t/ Note that there is no duplication here since they have canonical tags. My only concern is that:
Is it okay to have this kind of structure where the blog page have trailing slash while the rest are using non-trailing slash? Keen to hear from you guys. Cheers!0 -
6 .htaccess Rewrites: Remove index.html, Remove .html, Force non-www, Force Trailing Slash
i've to give some information about my website Environment 1. i have static webpage in the root. 2. Wordpress installed in sub-dictionary www.domain.com/blog/ 3. I have two .htaccess , one in the root and one in the wordpress
Intermediate & Advanced SEO | | NeatIT
folder. i want to www to non on all URLs Remove index.html from url Remove all .html extension / Re-direct 301 to url
without .html extension Add trailing slash to the static webpages / Re-direct 301 from non-trailing slash Force trailing slash to the Wordpress Webpages / Re-direct 301 from non-trailing slash Some examples domain.tld/index.html >> domain.tld/ domain.tld/file.html >> domain.tld/file/ domain.tld/file.html/ >> domain.tld/file/ domain.tld/wordpress/post-name >> domain.tld/wordpress/post-name/ My code in ROOT htaccess is <ifmodule mod_rewrite.c="">Options +FollowSymLinks -MultiViews RewriteEngine On
RewriteBase / #removing trailing slash
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)/$ $1 [R=301,L] #www to non
RewriteCond %{HTTP_HOST} ^www.(([a-z0-9_]+.)?domain.com)$ [NC]
RewriteRule .? http://%1%{REQUEST_URI} [R=301,L] #html
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^([^.]+)$ $1.html [NC,L] #index redirect
RewriteCond %{THE_REQUEST} ^[A-Z]{3,9}\ /index.html\ HTTP/
RewriteRule ^index.html$ http://domain.com/ [R=301,L]
RewriteCond %{THE_REQUEST} .html
RewriteRule ^(.*).html$ /$1 [R=301,L]</ifmodule> The above code do 1. redirect www to non-www
2. Remove trailing slash at the end (if exists)
3. Remove index.html
4. Remove all .html
5. Redirect 301 to filename but doesn't add trailing slash at the end0 -
How to switch from URL based navigation to Ajax, 1000's of URLs gone
Hi everyone, We have thousands of urls generated by numerous products filters on our ecommerce site, eg./category1/category11/brand/color-red/size-xl+xxl/price-cheap/in-stock/. We are thinking of moving these filters to ajax in order to offer a better user experience and get rid of these useless urls. In your opinion, what is the best way to deal with this huge move ? leave the existing URLs respond as before : as they will disappear from our sitemap (they won't be linked anymore), I imagine robots will someday consider them as obsolete ? redirect permanent (301) to the closest existing url mark them as gone (4xx) I'd vote for option 2. Bots will suddenly see thousands of 301, but this is reflecting what is really happening, right ? Do you think this could result in some penalty ? Thank you very much for your help. Jeremy
Intermediate & Advanced SEO | | JeremyICC0 -
How to switch to HTTPs in Bing?
I am creating a list of all things I need to do for switching a site over to HTTPs. I can find great instructions for Google, but nothing for Bing. If I do everything that Google requires, is the only thing I need to do for Bing is the site move?
Intermediate & Advanced SEO | | EcommerceSite0 -
Switching domains, need tips and trick?
I currently have my sub-product hosted on a subdomain that I have, for example say it is: x.mysite.com. I plan to migrate and move this to mysite.com. I was planning to do this by having mysite.com pointing to x.mysite.com and do a 301 redirect x.mysite.com to mysite.com. Is it as simple as that? Any other consideration, tips and tricks that I should be aware of so that my SERP doesn't get messed up. Any articles or guides on this subject matter would be highly appreciated
Intermediate & Advanced SEO | | herlamba0 -
Switching from Google Plus Local to Google Plus Business
Greetings, We have a website design firm located in India. We wanted to target customers in our city who are looking for website design locally. And with google plus local and a few content marketing would get us into first page very soon because none in the competition is using social signals or even content marketing. BUT unfortunately from last month even though our Google Places is verified we cant verify our Google Local Plus page https://plus.google.com/b/116513400635428782065/ It just shows error 500. Its a bug and its been a year for people without it being addressed. So we are skeptical if our strategy would work without Google+. At the least we decided we would just make company local page and connect it with website. But it might not have effect as local. So we are still unsure which step to take either to wait for google to fix it.(feedbacks emails calls nothing worked) OR We start the process with Google Business Category.
Intermediate & Advanced SEO | | hard0 -
Switch from CCTLD to .com - Am I missing anything?
We currently have 14 international sites. (.co.uk, .fr, .es, .com.au, etc) and (language differences aside) the content is the same on all. I want to move this content from example.co.uk to example.com/uk/ (and from example.com.sg to example.com/sg/) to consolidate our domain authority, for brand consistency, and to reduce the overhead of maintaining 14 different domains. Our .com has by far the most domain authority (90) and often outcompetes newer smaller sites like .com.sg in local search) Other sites, however, (like .co.uk DA74) do quite well locally. My goal is to improve the performance of those sites with a low DA, without hurting the larger sites, and also to avoid the disappearance of local content in local search. e.g. currently when a user searches for "widgets" they find example.co.uk/widgets/ but in future I want them to find example.com/uk/widgets My plan is to redirect pages with 301 redirects, and use rel-alternate and hreflang metadata to manage indexing. So in the example above, I'd 301 example.co.uk/widgets to example.com/uk/widgets, then use the following metatag on that new page to suggest that it is the UK english version (for users in the UK) of a canonical page in the .com: (this is in accordance with the suggestion on this page http://support.google.com/webmasters/bin/answer.py?hl=en&answer=189077) My question is: Am I going to severely damage the ranking of, e.g., UK pages in UK search engines by doing this? Is there a better way to do this? Any input greatly appreciated. Thanks, Dennis
Intermediate & Advanced SEO | | dennis.globalsign0 -
Switching to masked affiliate links
Hi there, I run a content affiliate website where I introduce products in articles and then link to merchants where the user can buy the respective product. Currently I am using regular affiliate links here with the "nofollow" attribute. With growing size of the site, I would like to switch to masked affiliate links, so instead of a link like "jdoqocy.com/click-123" I want to use "mydomain.com/recommend/123". My question here is: When switching to masked affiliate links, does it makes sense to also convert all the older unmasked affiliate links? If yes, what would be the best way to do that - Convert all old links at once or convert them over time (e.g. over a few month)? Currently about 2/3 of my site's outbound links are unmasked, external affiliate links. So I am afraid that changing this relatively large share of links from unmasked external affiliate links to masked links doenst look natural at all... Thank you for your advice!
Intermediate & Advanced SEO | | FabRag0