Webmasters Stack Exchange is a question and answer site for pro webmasters. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I'm moving my site and the URL structure has changed because of the new CMS. The old URLs are similar to /my.products.htm, but on the new site we are changing the URLs to /my-products.

Is there a way to redirect all the products to this new URL scheme using a mod_rewrite 301 redirect? Or is there another method I could use? The old site ran PHP the new one runs on Netsuite if that helps.

share|improve this question
up vote 2 down vote accepted

Add this to the .htaccess file in your root directory

RewriteRule ^([A-Za-z0-9]+)\.([A-Za-z0-9]+)\.htm$ http://www.example.com/$1-$2 [R=301]
share|improve this answer
    
Thank you so much! It works perfectly! Google had been indexing the old IP because of some DNS changes we have no control of until the end of April. This corrects those URLs to point in the right direction. Thanks again! – Nick Mar 24 '11 at 21:29
    
You're Welcome. – Emmanuel Mar 25 '11 at 4:35

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.