Forum Moderators: phranque

Message Too Old, No Replies

Mod_rewrite format change, need 301 help!

         

theblade24

1:29 pm on Sep 28, 2005 (gmt 0)

10+ Year Member



I am currently using this url format for about 500 links on my site

www.#*$!#*$!xxxxxx.com/cp-app/prod/body-jewelry/MM-12345.html

cp-app is cp-app.cgi?
prod is short for product page
body-jewelry is just a fake directory for the keywords to be in the url
MM-12345 is my product id

I'm achieving this with this rewrite rule:

RewriteRule ^cp-app/([^/]*)/body-jewelry/([^/]*)/?\.html$ shop/cgi-bin/cp-app.cgi?pg=$1&body-jewelry&ref=$2 [L]

I'd like to change this and add the product name to the end of the url using this which works fine:

RewriteRule ^cp-app/([^/]*)/body-jewelry/([^/]*)/([^/]*)/?\.html$ shop/cgi-bin/cp-app.cgi?pg=$1&body-jewelry&ref=$2&product_name_encoded=$3 [L]

I now need to somehow globally redirect all those links done the first way to the second way with a 301 redirect.

It has been suggested to use this:

RewriteRule ^cp-app/prod/body-jewelry/(.*)?\.html$ [xxxxxxxxxxxx.com...] [R=301,L]

which unfortunately isn't working.

Can someone give me some advice on how to correct this redirect so all my links in Google the old way will hit and be redirected to the new way?

Thanks!

jdMorgan

3:07 pm on Sep 28, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



> I'd like to change this and add the product name to the end of the url...

Can you provide examples of the new and old URL formats and explain how they realte to each other?

For example, if this is the old local URL-path:
/cp-app/prod/body-jewelry/MM-12345.html

then what would the new one look like?

It's not clear from your RewriteRule, because that rule apparently contains at least one error.

Jim

theblade24

3:52 pm on Sep 28, 2005 (gmt 0)

10+ Year Member



Old Style

www.#*$!#*$!#*$!xxx.com/cp-app/prod/body-jewelry/MM-12345.html

Old rule

RewriteRule ^cp-app/([^/]*)/body-jewelry/([^/]*)/?\.html$ shop/cgi-bin/cp-app.cgi?pg=$1&body-jewelry&ref=$2 [L]

New style

www.#*$!#*$!xxxxxx.com/cp-app/prod/body-jewelry/MM-12345/j-d-morgan-car.html

New Rule

RewriteRule ^cp-app/([^/]*)/body-jewelry/([^/]*)/([^/]*)/?\.html$ shop/cgi-bin/cp-app.cgi?pg=$1&body-jewelry&ref=$2&product_name_encoded=$3 [L]

I'd like to remove the old rule from htaccess and have any hit on the old format redirected via 301 to the new format.

jdMorgan

5:56 pm on Sep 28, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



I don't think that will be possible, because the old URL does not 'carry' the information needed to build the new URL.

In other words, how would your code know to add "/j-d-morgan-car" to form the new URL?

mod_rewrite cannot 'create' new information, it can only re-arrange the information present in the requested URL, and/or add fixed-value strings to what is there.

This WebmasterWorld library [webmasterworld.com] thread, Beginning Mod Rewrite [webmasterworld.com] --and specifically, the first section-- may be useful to you.

Jim

theblade24

6:11 pm on Sep 28, 2005 (gmt 0)

10+ Year Member



I created another variable in the shopping cart called product_name_encoded. That is how the new info is in the new url.

So if it can't be redirected.....

1. Do you suggest leaving the old rewrite rule in htaccess to handle any currently spidered links until they filter off and are dropped from the search results?

2. If all the links are done in the new format on my site from now on.......

A. Will the search engines figure out the old style is no good anymore even if I have the old rewrite rule in htaccess?

B. Will I get a dupe penalty if they both work for a period of time together?

Advice on how to handle the transition?

I haven't said thank you yet........so thank you J.D.!

jdMorgan

7:37 pm on Sep 28, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



1. I'd suggest leaving the redirects in place until the majority of your important pages have been listed by their new URLs in the search results.

2A. Because the search engines follow links, the old URLs will fall out of the indices of the search engines -- They'll go "supplemental" in Google. At that point, you can remove the redirects.

2B. Duplicate content is one thing I don't like to speculate on. In most cases I don't see 'penalties' unless the content is massively-duplicated. I cleaned up most of my sites back when AltaVista was king, so I have limited experience with duplication in the current search environment.

Really, the best advice I can come up with is to implement the new system, and then proceed carefully by observing the results, deleting the redirects as the new URLs come to dominate your results. I might even suggest basing your decisions on the traffic through, rather than the search rank of, the old and new URLs. This would take all of the search engine traffic into account.

Jim

theblade24

8:28 pm on Sep 28, 2005 (gmt 0)

10+ Year Member



Would it be safe to say....that with the product name in the url that the ranking "should" be higher for the same page?

jdMorgan

9:46 pm on Sep 28, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



For searches on the exact keyword that appears in the URL, a tiny bit. But more important is that the new URL will outrank the old based on the number of links to it. Update all the links on your site, and as many deep-links from other sites as possible.

Since this is now getting into SEO, I'd advise you to seek more and possibly-better advice in the search-engine-specific forums.

Jim