Question

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.

Was it helpful?

Solution

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.

OTHER TIPS

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.com');

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

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.com');

UPDATE wp_posts SET post_content = replace(post_content, 'http://IP', 'http://www.yoursite.com');
Licensed under: CC-BY-SA with attribution
Not affiliated with wordpress.stackexchange
scroll top