Mod Rewrite WTF redirect / to no slash?

Status
Not open for further replies.

crossfittn

Afro Blue
Feb 4, 2007
1,135
8
0
TN
topyc.io
How can I redirect /foldername/pagename/ to /foldername/pagename ???

I'm using wordpress. Google is crawling and indexing both versions it seems and I'm hugely punished in rankings because of this dupe content issue. It's really obvious I have a penalty. I don't even rank #1 for my own domain name.
 


I am using the opposite - add slash if it's not there:

Code:
RewriteRule ^/*([^/]+/+)*([^.]*[^/])$ http://%{HTTP_HOST}%{REQUEST_URI}/ [L,R=301]

maybe you can alter it somehow to do the opposite work :)
 
This isn't tested but you can try this in your .htaccess

Code:
RewriteRule ^/foldername/pathname/$ /foldername/pathname [nc]
It can usually be that easy but if it doesn't work then just remove the line and try again.
 
You should redirect /folder/folder to /folder/folder/. Most webservers will do that by default redirecting slash to no slash is kind of funky.
 
Status
Not open for further replies.