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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T00:27:36+00:00 2026-06-09T00:27:36+00:00

I have been given the task of updating a rather ugly, dated site, that

  • 0

I have been given the task of updating a rather ugly, dated site, that has info on hundreds of cities, all of which sit on their own subdomain, for example:

london.sitedomain.com

The plan is to get rid of all these subdomains and set the site up properly as pages, in this format:

sitedomain.com/london

Unfortunately, there is a mass, hardcoded list making up a dropdown menu, looking something like this (but with hundreds):

<a href="http://sydney.sitedomain.com">Sydney</a>
<a href="http://auckland.sitedomain.com"> Auckland</a>
<a href="http://melbourne.sitedomain.com"> Melbourne</a>
<a href="http://perth.sitedomain.com"> Perth</a>
<a href="http://wellington.sitedomain.com"> Wellington</a>

If I set this huge list up as a php string, is there a decent way to change, in bulk, every subdomain substring into the correct format, as stated above? Or is there a better solution you can think of?

  • 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-09T00:27:39+00:00Added an answer on June 9, 2026 at 12:27 am

    I think you’d be better off using a search and replace in a program like Notepad++ or Sublime Text. Both can do a regular expression search and replace of a folder (and subfolders.) I don’t think PHP would be the best solution to this for a bunch of hard coded links (it could be done, but is much easier and more reliable this way.)

    Use the following regular expression:

    search:  http://(.*?)\.sitedomain.com
    replace: http://sitedomain.com/\1
    

    You could potentially do that in PHP with those search and replace fields, but if you just need to change a bunch of HTML files then I think using a text editor is much better.

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

Sidebar

Related Questions

I have been given the task of devising a custom forms manager that has
I have been given task to check for url that site:domain (If index in
I have been given a task to create a Python file that will take
I have been given a task of finding the info abt n/w or, the
I have been given a task that can be simplified to this scenario: Customers
I have been given a simple task, that I cannot seem to figure out
The odd task that I have been given is to serialize a LARGE object
I have been given the task of adding functionality to an existing IIS 6.0
I have been given the task to design a database to store a lot
I have been given the task of re-writing some libraries written in C# so

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.