How to remove trailing slashes in URLs using .htaccess (Apache)?
-
I want my URLs to look like these:
http://www.domain.com/buy/shoes
http://www.domain.com/buy/shoes/red
Thanks in advance!
-
I am sorry my friend. Somehow I missed your response.
It should have been: RewriteRule ^(.*)/$ /$1 [R,L]
So, you missed the /
And it is also used to remove the trailing slash from URLs just like the one that I gave you earlier.
Best,
Devanur Rafi
-
And what is the difference of this to the one you've answered?
RewriteBase /
RewriteRule ^(.*)/$ $1 [R,L] -
Thanks Devanur! Big help. By the way, I'm still looking for an opinion about this and I'm sure you can help me with this issue:http://moz.com/community/q/how-can-i-301-redirect-a-series-of-pages-ex-page-1-page-2-page-3-to-one-landing-page-new-url
-
Hi, here you go.....
RewriteRule ^(.)/(?.)?$ $1$2 [R=301,L]
Please note that the thing which looks like a capital V in the above rule is actually the backward slash and forward slash together.
Best,
Devanur Rafi
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
-
Submitting url to link directories seen as un-natural link building?
Hi I have been a lurker for a long time, so I finally took the step to make my 1st post, and will hopefully start giving back more in the future since I have gained invaluable info from this great site Background I hired a new freelancer on our team of SEO consultants ("specialists") During the course a month he (the new consultant) submitted our website to numerous link directories (he assured me this is good), today I received the report of the work he had been doing for the past 4-weeks. I opened the report and I was furious and wanted to sack him there and then The Problem / My Question He had submitted our website to 150 directories with various levels of page rank, ranging from 7-1. Most of the directories are totally irrelevant to our niche (we are in the catering business) and he had gone and submitted the site to directories such as "finance busters", "questfinder" etc For all 150 submissions he used: exactly the same url exactly the same title exactly the same description exactly the same keywords My Concern Am I right to be worried about this? Or am I completely wrong and may this actually have an effect (even if none)? The way I see it is that Google is seeing 150 duplicate links coming from irrelevant directories all within a months time, which will trigger a red flag and possibly do major damage to my site, which has always been strictly white hat and been doing pretty well. p.s does link directory submissions even count these days anyway? Thanks for reading and advice very much welcome
White Hat / Black Hat SEO | | timthetanker0 -
Changing url to recover from algorythmic penalty
Hello, If I think that a website was hit algorithmically, I would like to buy a new domain name and publish all the content from the first website there. I will take the first site down and this one would be the only one this content. Will Google see that it's the same content than a penalized website posted before and will penalize the new domain name even though it has 0 links pointing to it? Regards.
White Hat / Black Hat SEO | | EndeR-0 -
Penalty removing company recommendation?
We've got a manual penalty, not sitewide, that we've been trying to remove and keep getting our reconsideration request denied. We also do not have the manpower to manually check backlinks, contact domain owners, etc anymore. Does anyone have recommendations on a company to use?
White Hat / Black Hat SEO | | CFSSEO0 -
Is it okay to use eLocal services?
Is it okay to use a service like eLocal's 'reach the web' to clean up our company listings on website directories or is it considered black hat? Our company name and address is inconsistent on many of the website directories and we want to clean it up fast. eLocal has a service that can do this. I just want to make sure it's not considered bad to have a vendor do it. Thanks!
White Hat / Black Hat SEO | | KristyFord0 -
Are Links from blogs with person using keyword anchor text a Penguin 2.0 issue?
Hello, I am continuing a complete clean up of a clients link profile and would like to know if Penguin is against links from blogs with the user including keywords as anchor text? So far I have been attempting to get them removed before I go for a disavow. An example would be the work clothing comment at the bottom of: http://www.fashionstyleyou.co.uk/beat-the-caffeine-rush.html/comment-page-1 I am also questioning if we should keep any link directories, so far I have been ruthless, but worry I will be losing a hell of a lot of links. For example I have kept the following: http://www.business-directory-uk.co.uk//clothing.htm Your comments are welcomed!
White Hat / Black Hat SEO | | MarzVentures0 -
Potential Implications of using the Disavow tool to remove thousands of links
So here's the situation. My companies site has over 30 thousand backlinks from Rippling.info These links all point to 3 product pages, some of which are no longer in production. Apparently a former employee was experimenting with some link farm ideas. My questions are; 1. does anyone here have experience with rippling.info? Is it legit? It seems like a link farm but Google allows adsense ads??? I thought Google was against link farms... 2. if I use the Disavow tool in Webmaster Tools to tell Google these 30k+ incoming links are to be ignored, will there be any consequences? -Google Analytics shows zero referral traffic since jan 1st 2012.
White Hat / Black Hat SEO | | mjmorse0 -
Best use of domains with keywords
I own a domain with just the company name in it (no keywords) that I use as main domain. I also own some other domain with keywords inside that right now I redirect all to the main domain with a 301 redirect. What is the best use for these domains? Should I use them when I do link building or is better to use just the main domain? Can they be useful to increase the main domain link juice/page rank? If yes, how? Thanks
White Hat / Black Hat SEO | | darkanweb0