Forum Moderators: Robert Charlton & goodroi

Message Too Old, No Replies

trailing /

trailing / error, apache mod_rewrite

         

snook

2:45 pm on Jul 13, 2006 (gmt 0)

10+ Year Member



we recently redid our site 4 months ago, and we made an error with our urls

The old site had a good amount of the site without trailing /
like so
www..mysite.com/abc

are new site has
www.mysite.com/abc/

Now google has both listed, with the older site url with higher page rank.

What is the best way to correct this?
A rule we can put in apache?

Thanks in advance for the help

snook

3:23 pm on Jul 13, 2006 (gmt 0)

10+ Year Member



I probably should of put this in the Apache forum, but I wanted to make sure I correct this the right way, not to loose page rank.

Reading Apache doc we were going to put


RewriteEngine on
RewriteBase /~quux/
RewriteRule ^foo$ foo/ [R]

And then remove all trailing / from our code.
Would that be the correct way to fix?

manca

3:44 pm on Jul 13, 2006 (gmt 0)

10+ Year Member



Just do a perm redirection to not trailing slash urls to the ones which contain / . That should do a trick, and google will index only one "version" of urls....

Manca

jdMorgan

5:34 pm on Jul 13, 2006 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



In order to tell the search engines what the correct URLs are, so that they can drop the incorrect ones, you want a 301-Moved Permanently redirect, so the syntax is:

RewriteEngine on
RewriteBase /~quux/
RewriteRule ^foo/$ [b]http://www.example.com/[/b]foo [[b]R=301,L[/b]]

However, if 'foo' is a directory, then this won't work, since a trailing slash is required on directory-paths.

Jim

maurizio63

5:53 pm on Jul 13, 2006 (gmt 0)

10+ Year Member



I have the same problem with WordPress :-(

snook

10:47 am on Jul 14, 2006 (gmt 0)

10+ Year Member



thanks so much for the help!

I have page rank on the old urls
If I do the 301's to the new urls, will the page rank carry over?

If it will not carry over, then I have another question

if I do the 301 to old urls

Do I also need to go through the code and fix the url (to be without trailing dash)?

or won't it matter because I have the 301's in place?