Avatar of A A
A A

asked on 

issue as after cloning word press site I found that in google browser that all links are as href to old server name instead of new server name

Hi experts
I have issue issue as after cloning word press site from domain to another  I found that in google browser that all links are as href to old server domain name instead of new server domain  name as I don't know where is the location of the page on server that when I click the website and view page source in the browser I found css sytle sheet and many href so how can I edit those link to load from new server known that I don't know location of this file that browser open when I go to website and click view source page as website is built on wordpress
Linux* webdevelopmentHTMLWordPress

Avatar of undefined
Last Comment
David Favor
Avatar of noci
noci

if the hrefs were relativ in the source they should also be transported. (The browser will add the host part when needed).
If the href contains hardcoded hsotnames... well it probably was intentional to nail those links to the original sitename ....
this is what relative URLs are for. transportable sites.)
Avatar of David Favor
David Favor
Flag of United States of America image

You mention, "I have issue issue as after cloning word press site from domain to another" which likely explains the problem.

You can never "clone" a WordPress Website + expect it to work.

This isn't the way the WordPress database is designed.

You must do the following.

1) Make a backup of all files + database data.

2) Restore the data somewhere else.

3) Run a serialized data aware rename script across the database.

4) For brain-dead themes like Divi, you must also run a script or command line rename to rename all broken CSS cache files Divi builds.

5) Be aware #4 applies to many themes, Divi is just one of this troublesome... ilk...

Note: There is no cure for #4 except writing custom code... or better... deinstalling the theme/plugins which break WordPress best practices in this horrible manner.

6) #1-#3 are handled by any WordPress backup + restore plugin.

https://wordpress.org/plugins/duplicator is one such working plugin + there are 100s-1000s of other backup plugins that also do this correctly.
Avatar of David Favor
David Favor
Flag of United States of America image

https://stackoverflow.com/questions/13319638/working-with-serialized-data-in-wordpress is one of 1.4M responses this topic.

Search - understanding wordpress serialized data - for additional references.
Avatar of Scott Fell
Scott Fell
Flag of United States of America image

The first thing to do in WP is go to Settings->Permalinks.  Click Save even if the settings are as you expect. This may fix the issue.

If that does not work, you can try a broken link checker plug in like https://wordpress.org/plugins/broken-link-checker/.  Please make sure to back up your site/database before making changes.

Although I have not messed with the database recently, I have in the past manually updated links in the db using a query  https://codex.wordpress.org/Database_Description  I would try the first two options though as they will be safer.
Avatar of A A
A A

ASKER

Thanks David and scott and noci for your kind replies

but for example a page like that it appears when you do view source from website page so  how can I modify their headers links href from domain to another
<!--[if !IE]> -->
<html lang="es" dir="ltr">
<!-- <![endif]--><head>

<!-- Set the viewport width to device width for mobile -->
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">

   <meta name="viewport" content="width=device-width, initial-scale=1, user-scalable=0">

<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<link rel="alternate" type="application/rss+xml" title="
 href="http://www.domain.com.pe/rss.xml" />
<link rel="shortcut icon" href="http://www.domain.com.pe/sites/all/themes/custom/theme/favicon.ico" type="image/vnd.microsoft.icon" />
<meta name="generator" content="Drupal 7 (http://drupal.org)" />
<link rel="canonical" href="http://www.domain.com.pe/" />
<link rel="shortlink" href="http://www.domain.com.pe/" />
<meta property="og:site_name" content="
<meta property="og:type" content="website" />
<meta property="og:url" content="http://www.domain.com.pe/" />
<meta property="og:title" content=
<style type="text/css" media="all">
@import url("http://www.domain.com.pe/modules/system/system.base.css?qt241r");
@import url("http://www.domain.com.pe/modules/system/system.messages.css?qt241r");
@import url("http://www.domain.com.pe/modules/system/system.theme.css?qt241r");
</style>
<style type="text/css" media="all">
@import url("http://www.domain.com.pe/sites/all/modules/");
@import url("http://www.domain.com.pe/sites/all/modules/.css?qt241r");
@import url("http://www.domain.com.pe/modules/comment/comment.css?qt241r");
@import url("http://www.domain.com.pe/sites/all/modules/date/date_api/date.css?qt241r");
@import url("http://www.domain.com.pe/modules/field/theme/field.css?qt241r");
@import url("http://www.domain.com.pe/modules/node/node.css?qt241r");
@import url("http://www.domain.com.pe/modules/search/search.css?qt241r");
@import url("http://www.domain.com.pe/modules/user/user.css?qt241r");
@import url("http://www.domain.com.pe/sites/all/modules/views/css/views.css?qt241r");
@import url("http://www.domain.com.pe/sites/all/modules/ckeditor/css/ckeditor.css?qt241r");
</style>
Avatar of Scott Fell
Scott Fell
Flag of United States of America image

When you view->source, you are looking at rendered HTML.  In Wordpress, and other CMS systems, you are not working with static HTML. Instead, the HTML is rendered through multiple methods (functions).

You need to attack the underlying issue.

Did you try anything suggested yet?  That is where to start.
Avatar of noci
noci

With relative URL: there is NO https:// or http:// no  hostname with ports etc.   So just use URI's  
it should be generated like:
<!--[if !IE]> -->
<html lang="es" dir="ltr">
<!-- <![endif]--><head>

<!-- Set the viewport width to device width for mobile -->
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">

   <meta name="viewport" content="width=device-width, initial-scale=1, user-scalable=0">

<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<link rel="alternate" type="application/rss+xml" title="
 href="/rss.xml" />
<link rel="shortcut icon" href="/sites/all/themes/custom/theme/favicon.ico" type="image/vnd.microsoft.icon" />
<meta name="generator" content="Drupal 7 (http://drupal.org)" />
<link rel="canonical" href="/" />
<link rel="shortlink" href="/" />
<meta property="og:site_name" content="
<meta property="og:type" content="website" />
<meta property="og:url" content="/" />
<meta property="og:title" content=
<style type="text/css" media="all">
@import url("/modules/system/system.base.css?qt241r");
@import url("/modules/system/system.messages.css?qt241r");
@import url("/modules/system/system.theme.css?qt241r");
</style>
<style type="text/css" media="all">
@import url("/sites/all/modules/");
@import url("/sites/all/modules/.css?qt241r");
@import url("/modules/comment/comment.css?qt241r");
@import url("/sites/all/modules/date/date_api/date.css?qt241r");
@import url("/modules/field/theme/field.css?qt241r");
@import url("/modules/node/node.css?qt241r");
@import url("/modules/search/search.css?qt241r");
@import url("/modules/user/user.css?qt241r");
@import url("/sites/all/modules/views/css/views.css?qt241r");
@import url("/sites/all/modules/ckeditor/css/ckeditor.css?qt241r");
</style>

Open in new window

The browser should then fill in the hostname from when you typed it.
(there might some exeptions like canonical... ) 
Avatar of Scott Fell
Scott Fell
Flag of United States of America image

I have issue issue as after cloning word press site from domain to another  I

After a second look at your code, it looks like you are using drupal and not Wordpress. If you are using Wordpress, you really should be looking at your theme set up as well as settings > permalinks
User generated image


sdsd

ASKER CERTIFIED SOLUTION
Avatar of David Favor
David Favor
Flag of United States of America image

Blurred text
THIS SOLUTION IS ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
Linux
Linux

Linux is a UNIX-like open source operating system with hundreds of distinct distributions, including: Fedora, openSUSE, Ubuntu, Debian, Slackware, Gentoo, CentOS, and Arch Linux. Linux is generally associated with web and database servers, but has become popular in many niche industries and applications.

71K
Questions
--
Followers
--
Top Experts
Get a personalized solution from industry experts
Ask the experts
Read over 600 more reviews

TRUSTED BY

IBM logoIntel logoMicrosoft logoUbisoft logoSAP logo
Qualcomm logoCitrix Systems logoWorkday logoErnst & Young logo
High performer badgeUsers love us badge
LinkedIn logoFacebook logoX logoInstagram logoTikTok logoYouTube logo