Image Source Points to Wrong Link When Displayed on Subsite/SubDomain
-
Hi All
I have a site https://www.example.com with a subsite or subdomain address https://subsite.example.com. When images are uploaded in the dashboard of the subdomain (i.e. https://subsite.example.com/wp-admin) to the media library, they go where they are supposed to be – the images folder within the subdomain folder. But when displayed – whether in the media library or front end – images are not showing because img src points to https://example.com/wp-content/uploads/2022/02/imageName.jpg instead of
https://subdomain.example.com/wp-content/uploads/2022/02/imageName.jpg.In wp-config.php, I have added the following (without it, all internal links will go to https://example.com instead of https://subsite.example.com):
define('WP_HOME','https://subsite.example.com'); define('WP_SITEURL','https://subsite.example.com');
I also managed to get some of the images showing on the front end by adding a php string replace code on the template file that changes “example” to “subsite.example”, but this is only a temporary fix and does not affect dashboard, where images are not showing in media libray.
Is there something that should be added to or changed in .htaccess and/or wp-config.php?
- The topic ‘Image Source Points to Wrong Link When Displayed on Subsite/SubDomain’ is closed to new replies.