Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6209171
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T05:56:17+00:00 2026-05-24T05:56:17+00:00

I have updated my site’s SEO friendly URLs and submitted a new site map

  • 0

I have updated my site’s SEO friendly URLs and submitted a new site map to Google. The problem is that I seem to be getting punished in rankings for having my old content still show up under the old URL as well as the new URL (the one in the site map). I have been trying to figure out how to capture the variables with regex to make the following work but cannot seem to get it right.

Any ideas? We have an automotive classifieds that has been affected by the panda/farmer update.

Old URL:  http://www.mysite.com/forsale/light-trucks/12345/2010-dodge-ram-1500.html

New URL:  http://www.mysite.com/cars-trucks-for-sale/light-trucks/2010/dodge/ram-1500/12345/2010-dodge-ram-1500.html

Right now, either one of those URLs will work (they rewrite to a script: showcontent.php?id=12345).

This means duplicate content since Google still knows about my old URL and my site maps all show only the new URL…

I need to show a a 301 redirect and make sure that my old content gets rewritten to the new format on the fly but notice that I have some NEW url parameters that are not in the old url…

RewriteRule ^/?(forsale)/([-a-zA-Z0-9_-]+)/([0-9]+)/([-a-zA-Z0-9_-]+)\.html$ showcontent.php?id=$3 [L]

RewriteRule ^/?(cars-trucks-for-sale)/([-a-zA-Z0-9_-]+)/([0-9]+)/([-a-zA-Z0-9_-]+)/([-a-zA-Z0-9_-]+)/([0-9]+)/([-a-zA-Z0-9_-]+)\.html$ showcontent.php?id=$6 [L]

The above rules work now but I need to capture inbound requests to the first one and rewrite them to the second. I could just stop honouring the original URL but I had some rank on those and I don’t want to just show a 401 error.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-24T05:56:17+00:00Added an answer on May 24, 2026 at 5:56 am

    As I understand content-type and new-content-type are constant values and that is the ONLY difference between old and new URLs.

    If so — there are quite a few ways of doing this:

    1. Using mod_rewrite (you asked for it — place these lines in .htaccess in website root folder. If placed elsewhere some tweaking will be required):

    Options +FollowSymLinks -MultiViews
    
    RewriteEngine On
    RewriteBase /
    
    RewriteRule ^content-type/([^/]+)/(\d+)/([^/]+\.html)$ http://www.mysite.com/new-content-type/$1/$2/$3 [R=301,L]
    

    Oh well — since URLs are very similar (based on the examples and description you have provided) — you can go even this simpler way (NOTE: this will redirect ANY URLs in /content-type/ folder. If your aim is to redirect only .html ended URLs that match that structure, then do not use it):

    RewriteRule ^content-type/(.+)$ http://www.mysite.com/new-content-type/$1 [R=301,L]
    

    2. Not using mod_rewrite — URL structure of old and new URLs is very similar .. so even this will do the job (see the NOTE above):

    Redirect 301 /content-type/ http://www.mysite.com/new-content-type/
    

    This will redirect (301 Permanent Redirect) all requests to URL that starts with /content-type/ to exactly the same but with /new-content-type/ instead.


    UPDATE: more real URLs provided by OP

    Because your REAL URLs are quite different from old ones, there is no really good way to write a single line rewrite rule for this. Therefore I see 2 major options:

    1. Create redirect rule for EACH old URL (place it somewhere on the top of .htaccess, preferably in server config, if possible):

    Redirect 301 /forsale/light-trucks/12345/2010-dodge-ram-1500.html http://www.mysite.com/cars-trucks-for-sale/light-trucks/2010/dodge/ram-1500/12345/2010-dodge-ram-1500.html
    

    If you have tons of such old URLs .. then this approach is not really good — too many URLs to test on every single request + cost of maintenance (create these redirect rules).

    2. Keep using current redirect rules that you have in place (the one that rewrites to showcontent.php?id=12345). In this showcontent.php file generate proper URL (as it should be on a website) and compare to requested URL (take it from $_SERVER['REQUEST_URI']). If URLs are different then issue 301 redirect to a proper URL (using header() function). — This is how THIS website works, for example. It may be a bit slower than .htaccess (as PHP has to kick in) .. but MUCH easier to implement and maintain (virtually zero maintenance cost).

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I've updated my website to a Wordpress site. But now i have a problem
This is an odd problem. I have a site that is not rendering it's
I have a fully updated wordpress site with some plugins that enqueue some styles,
I have a large download site, an i have a code that updates each
I have updated many records already, but when it came to a word that
Since I have updated Jekyl to 0.12.0 my site doesn't compile anymore. Everywhere I
I have a Sharepoint 2007 site that is displaying the old/original title in the
I have created a simple site that reads a database table and displays it
I have such problem: Site was totaly redesigned and everything works fine on my
I have just updated my site to use a jQuery plugin jquery.raty.min.js The plugin

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.