admin管理员组

文章数量:1023803

So my problem is that I have hosted my wp from my localhost to aws light sail and assigned a static IP to my instance and then I mapped the website with my subdomain and then changed site address and wp address from wp-config to my subdomain then almost all the pages, posts and media showing my domain in source but two custom pages and some media items still showing IP address and because of that I am getting SSL warning because IP address does not have any SSL but my domain has. Any workaround will be appreciated.

So my problem is that I have hosted my wp from my localhost to aws light sail and assigned a static IP to my instance and then I mapped the website with my subdomain and then changed site address and wp address from wp-config to my subdomain then almost all the pages, posts and media showing my domain in source but two custom pages and some media items still showing IP address and because of that I am getting SSL warning because IP address does not have any SSL but my domain has. Any workaround will be appreciated.

Share Improve this question asked Feb 1, 2019 at 10:48 ManPreetManPreet 31 bronze badge 2
  • If you have previously added an image to a post or page inside the content, then that is saved as HTML with the URL as it was at the time of being added. So if you want to retroactively change media URLs inside content you need to do a search replace in the database. – Jacob Peattie Commented Feb 1, 2019 at 10:56
  • thanx man manually updated the links for 6-7 posts and issue solved – ManPreet Commented Feb 1, 2019 at 11:25
Add a comment  | 

3 Answers 3

Reset to default 1

If you have previously added an image to a post or page inside the content, then that is saved as HTML with the URL as it was at the time of being added. So if you want to retroactively change media URLs inside content you need to do a search replace in the database.

You need to use a search-and-replace process (I use the "Better Search and Replace" plugin) to change any URLs in your database from the old value to the current value.

Media is stored with the URL that it has when the media was added. Using a search/replace plugin is the easiest way to change those values when content moves to a new domain.

I'm not a fan of changing things in the wp-config.php file as mentioned by another. When I move a site, I change the values directly in the wp-options table (two locations contains the site URL). That is, IMHO, the best place to 'define' the site URLs.

As for SSL, make sure that your htaccess file is rewriting http to https. Then you will need to look at any plugins or functions (or Child Theme functions that you might be using) to ensure that any requests are https. For instance, perhaps your theme has a Google font on an external domain - make sure that the request is https.

you can paste this code in your the wp-config.php file,

define('WP_HOME','http://example');

define('WP_SITEURL','http://example');

you can also use search and replace plugin or use MYSQL script to replace all your links with your Ip to your domain name.

UPDATE wp_posts SET guid = replace(guid, 'http://IP','http://www.yoursite');

UPDATE wp_posts SET post_content = replace(post_content, 'http://IP', 'http://www.yoursite');

So my problem is that I have hosted my wp from my localhost to aws light sail and assigned a static IP to my instance and then I mapped the website with my subdomain and then changed site address and wp address from wp-config to my subdomain then almost all the pages, posts and media showing my domain in source but two custom pages and some media items still showing IP address and because of that I am getting SSL warning because IP address does not have any SSL but my domain has. Any workaround will be appreciated.

So my problem is that I have hosted my wp from my localhost to aws light sail and assigned a static IP to my instance and then I mapped the website with my subdomain and then changed site address and wp address from wp-config to my subdomain then almost all the pages, posts and media showing my domain in source but two custom pages and some media items still showing IP address and because of that I am getting SSL warning because IP address does not have any SSL but my domain has. Any workaround will be appreciated.

Share Improve this question asked Feb 1, 2019 at 10:48 ManPreetManPreet 31 bronze badge 2
  • If you have previously added an image to a post or page inside the content, then that is saved as HTML with the URL as it was at the time of being added. So if you want to retroactively change media URLs inside content you need to do a search replace in the database. – Jacob Peattie Commented Feb 1, 2019 at 10:56
  • thanx man manually updated the links for 6-7 posts and issue solved – ManPreet Commented Feb 1, 2019 at 11:25
Add a comment  | 

3 Answers 3

Reset to default 1

If you have previously added an image to a post or page inside the content, then that is saved as HTML with the URL as it was at the time of being added. So if you want to retroactively change media URLs inside content you need to do a search replace in the database.

You need to use a search-and-replace process (I use the "Better Search and Replace" plugin) to change any URLs in your database from the old value to the current value.

Media is stored with the URL that it has when the media was added. Using a search/replace plugin is the easiest way to change those values when content moves to a new domain.

I'm not a fan of changing things in the wp-config.php file as mentioned by another. When I move a site, I change the values directly in the wp-options table (two locations contains the site URL). That is, IMHO, the best place to 'define' the site URLs.

As for SSL, make sure that your htaccess file is rewriting http to https. Then you will need to look at any plugins or functions (or Child Theme functions that you might be using) to ensure that any requests are https. For instance, perhaps your theme has a Google font on an external domain - make sure that the request is https.

you can paste this code in your the wp-config.php file,

define('WP_HOME','http://example');

define('WP_SITEURL','http://example');

you can also use search and replace plugin or use MYSQL script to replace all your links with your Ip to your domain name.

UPDATE wp_posts SET guid = replace(guid, 'http://IP','http://www.yoursite');

UPDATE wp_posts SET post_content = replace(post_content, 'http://IP', 'http://www.yoursite');

本文标签: urlsShowing my server ip in source code for several links not for all links