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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T22:36:18+00:00 2026-05-27T22:36:18+00:00

Background: We are migrating a website hosted on a dot net based custom CMS

  • 0

Background: We are migrating a website hosted on a dot net based custom CMS to WordPress.

The Problem: The content in the various posts contains links to other content in the CMS. These links have been put in manually and contain the entire URL starting from http. While we have moved all the post contents to WordPress using a php script, the links within the content still point to the old links. Since the URL structure has changed there does not seem to be a programmatic way of replacing the links.

Example of the old url: http://www.example.com/doing-this-and-that-1234.aspx

Example of the new url: http://www.example.com/categoryname/doing-this-and-that/

Request: I need ideas on how can we handle this without needing to change all links manually.

Thanks in advance.

  • 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-27T22:36:19+00:00Added an answer on May 27, 2026 at 10:36 pm

    I’m doing something similar at the moment, migrating a huge static html store to on run on django (it’s painful and bloody).

    Our solution isn’t anything particularly elegant. During migration of each page, we are noting the old url, then the new url, and add them to a redirect database. Once we’ve migrated all of our content to the new backend and url structure, we’re running a script that will identify all links in the document with these xpath selectors:

     //a/@href
     //img/@src
    

    Next we pull up the redirects from our redirect table and replace the links with the regexes below.

    #escape special characters to avoid problems with the regex
    link = link.replace('#', r'\#')
    link = link.replace('.', r'\.')
    link = link.replace('/', r'\/')
    link = link.replace(':', r'\:')
    
    #compile a regex, using the source link, and replace all existing links
    repl_regex = r'href\s{0,}\=[\s\"\']{0,}(%s)[\s\"\']{0,}'%link
    markup = re.sub(repl_regex, 'href="%s"'%dst_url, markup)
    
    #repeat for images
    repl_regex = r'src\s{0,}\=[\s\"\']{0,}(%s)[\s\"\']{0,}'%link
    markup = re.sub(repl_regex, 'src="%s"'%dst_url, markup)
    
    #Let me know if you have any questions, the above is written in python
    #and it sounds like you're using php and a .net language.
    

    Now while this method is probably more work than you’d like, and will require a little more upfront preparation, it has two advantages:

    1) By comparing every link in a document to a redirect table, you will be able to more easily identify missing pages / missing redirects

    2) SEO. Instead of making the googlebot recrawl your entire site, simply provide 301 redirects against your redirect table

    Let me know if you have any questions.

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

Sidebar

Related Questions

Background I am writing and using a very simple CGI-based (Perl) content management tool
Background: Migrating an application from ball of mud to MVC. Many classes contain HTML
I am actually migrating websites to ASP.NET 4.0, having problems with the new rendering
Background - I need a framework/approach to managed database updates for a .NET Winforms
Background I am writing code in VS 2010, .NET 4, C#. Also, in case
Background: I've wrote a small library that is able to create asp.net controls from
Background: I've got a web app on sub.domain.com. My primary website is on domain.com.
Okay -- we have an interesting problem. Some background: Our main application uses Indy
Background: I'm working on migrating from SQL Server 2000 to SQL Server 2005. This
I come from a Subversion background, but I am slowly migrating to Mercurial. When

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.