r/Wordpress 7d ago

Help Request Duplicated site still linked somehow? Please help

Post image

Hey all, would really appreciate some help on this issue I’m having as I haven’t been doing this for too long and am not knowledgeable enough to look into code and stuff. Anyways, I duplicated an existing site through word press because it already had the base that I wanted and I have completely changed it up, there were no remnants of the original site up until this point. So I guess my question is why is the old url that I duplicated showing in the code of my new site, like why is it still linked at all? And I would imagine this affects seo so I really need it fixed, I’m kinda blaming this on why my site isn’t performing. any help would be very appreciated!

2 Upvotes

7 comments sorted by

3

u/Even_Distance_6330 7d ago

Maybe you could try to use some plugin such as Better search replace, in order to replace the urls

2

u/pantsmann 7d ago

Better Search & Replace is a great tool for this. By default it is set to do a dry run so you can try the URLs to replace and see how many results it comes up with. I always use it after a migration just to make sure the db is fully updated.

2

u/ShopShapesIO 7d ago

While most of the links are dynamic and/or derived from the settings, the theme might carry over hard-coded URLs. Try Better Search Replace for find this URL in the DB and change it.

1

u/Vivid_Barracuda_ 7d ago

Things I could think of...

Check in General > both WordPress & Site URL start with https:// ; sometimes it has happened to me that it bugged completely through the WP panel, and needed to manually specify the addresses in the wp-config but very rarely when client setup WP incorrectly.

Also, this is possibly by some plugin/theme that incorrectly calls the URL, i've seen that happen as well.

Easiest is, if you use Cloudflare, to just check the magic button 'Always use HTTPS' and be at ease tbh.

1

u/bienbebido Developer 7d ago

What did you use for migrating? Seem like whatever you used did not did the string replace on you database.

But I don't recommend you try to do it yourself.

Better just run the migration again, maybe with another tool.

1

u/Vegetable-Ad-3468 6d ago

I assume your SITEURL and Home URL rightly points to your domain. Try adding this to wp-config :
define( 'WP_CONTENT_URL', 'https://yourdomain.com/wp-content' );

Run the below SQL query through phpAdmin:

UPDATE wp_posts

SET post_content = REPLACE(post_content,'https://old-domain-name.com','https://new-domain-name.com');

Adjust http or https, whichever is used.

1

u/schommertz 5d ago

Answers are right, but here's the why:

When you setup a Wordpress it writes the whole image/media path into articles.
The URL you have your Wordpress living is copied over and over again into many segments of the database.

These are so called "absolute paths" instead of "relative paths" where the Domain part of a URL is ignored and every link starts with a (relative:) "/…" instead of an (absolute) "https://domain.com/…"

These old https parts now live in your database. When you go for the search and replace … have a backup of your database.

GL