Forum Moderators: phranque
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!
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
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.
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
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.!
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
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