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 8454269
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T11:58:52+00:00 2026-06-10T11:58:52+00:00

I am creating a new wordpress site. I’ve imported over 1500 of my posts

  • 0

I am creating a new wordpress site. I’ve imported over 1500 of my posts from my old site. The problem is that wordpress has words like “an-the-a-if-is” in the URL, where my old website removed those.

This is a major problem for SEO and broken links as the new link looks like “the-cat-in-the-hat” and my old one just was “cat-hat”.

I want to ONLY change the past 1500 posts I’ve uploaded to strip specified words from the URL (via rewrite I assume), I have the list of words to remove. I want all new posts created to include the words, so I don’t just want to use .htaccess.

Is there a way via PHP to say “if post is older than XYZ date, strip these words, and serve it from the new rewritten URL, otherwise, serve it normally”

  • 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-06-10T11:58:54+00:00Added an answer on June 10, 2026 at 11:58 am

    You could run the following command on the database:

    UPDATE `wdp_posts`
    SET `post_name`= REPLACE(`post_name`,"-and-","-"),
    WHERE `post_date` < "20120101 00:00:00";
    

    (BACKUP THE DATABASE BEFORE YOU TRY THIS!)

    What this does is rename any post from before the 1st of Jan 2011, removing any occurrences of “-and” in the name (which becomes the URL).

    You’ll need to edit the date to fit your needs.

    And you’ll need to run this multiple times. Once for “-and-“, once for “-if-“, once for “-in-” etc. As pointed out in a comment, it will not replace words at the start or end of the url.

    You can do this in one query, but it’s rather hard to read so I’d recommend doing it one keyword at a time.

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

Sidebar

Related Questions

I have 2 custom fields in my WordPress system when creating new posts. One
I have problem creating new instance of excel 2007 using VBA (from Access 2002).
i am creating a related post article feature for my wordpress enabled site.being new
I am relatively new to wordpress, I am creating a custom theme, and so
when i am creating new android project from visual studio 2010 it gives the
I'm creating new Site Definitions using this method: http://weblogs.asp.net/paulballard/archive/2007/04/09/creating-a-custom-sharepoint-2007-portal-site-definition-using-the-portalprovisioningprovider-class.aspx and when they get created,
I'm trying to establish workflows for creating new projects and for setting old projects
Can I avoid third party code from creating new threads, starting new VMs, or
I'm creating a sitemap and my problem is that all & in links gets
I have been given a new task from the client which is basically creating

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.