How do I test images in WP migration without Changing URLs?
-
I'm redesigning example.com on a subdomain of my own site, so at example.mysite.com. As part of the redesign, I am optimizing the site's images. I used Wordpress Importer to get the content to the development site, but I did not import the images. Instead, I added the images to the development site by copying and moving over the contents of example.com's uploads folder. The posts at example.mysite.com are showing the images, but they are pulling them from the original location. I tried adding the following code to wp-config.php under the (misunderstood?) impression that the image URLs would use the development site's domain:
1 define('WP_HOME', 'http://example.mysite.com');
2 define('WP_SITEURL', 'http://example.mysite.com');I am not seeing any change and the images are still pulling from the original site. How can I test the images on the current site without actually changing the URLs in the database. (If I understand correctly, I could search and replace, but that is not what I am trying to achieve.) The original domain is not changing with the redesign, so there is no need to actually change the URLs. I just need to test the images, as I will be removing those that are not being used as well as optimizing the remaining images before moving the redesigned site over to the original domain.
-
If the images are coded into the website using "http://example.com/image.jpg" instead of "/image.jpg" then the images will always pull from example.com, instead if your test site.
If they were coded with "/image.jpg" then the code would pull from example.com when the page was there, and example.yoursite.com when you moved it over for testing.
-
I appreciate your response. I do not need to permanently change the urls, as the domain is not changing in the redesign. I just need to see that all the images I have edited are in place correctly on example.mysite.com. There must be a temporary/test solution.
-
It sounds like the URLs being used in the code aren't dynamic. There are two different ways to embed an image (and it's URL) on a page with html:
You can use a dynamic URL, where the domain will be whichever domain the page is on, like notice how there is no domain in front of the URL path, this means the domain will change depending on which website the code is on.
The other way, and the way it sounds like is being used on your site is This makes the URL definite, since all of it is defined. If you see that your images were put in with URLs like these, you'll need to make them dynamic to accomplish what you want to.
Got a burning SEO question?
Subscribe to Moz Pro to gain full access to Q&A, answer questions, and ask your own.
Browse Questions
Explore more categories
-
Moz Tools
Chat with the community about the Moz tools.
-
SEO Tactics
Discuss the SEO process with fellow marketers
-
Community
Discuss industry events, jobs, and news!
-
Digital Marketing
Chat about tactics outside of SEO
-
Research & Trends
Dive into research and trends in the search industry.
-
Support
Connect on product support and feature requests.
Related Questions
-
Change of URLs - Part of Migration
We are looking to change our URLs to this format /SKU/TITLE/COLOUR as part of our SEO migration.
Intermediate & Advanced SEO | | christwix
e.g. https://example.com.au/ac-rck-b/rolla-crew-knit/berry.html As of the moment, our URLs are TITLE/NO
e.g. https://example.com.au/rolla-crew-knit/6562563.html
(Shopify is creating a random number on the end of the URL which is representing a different colour) Is this fine SEO wise? Will this affect rankings and user experience?0 -
Changing sitemaps in console
Hi there, Does anyone have any experience submitting a completely new sitemap structure - including URLs - to google console? We've changed our sitemap plug in, so rather than /sitemap-index.xml, our main sitemap home is /sitemap.xml (as an example). Is it better to 410 the old ones or 301 redirect them to the new sitemaps? If 301, what do we do about sitemaps that don't completely correlate - what was divided into item1.xml, item2.xml is now by date so items-from-2015.xml, items-from-2016.xml and so on. On a related note, am I right in thinking that there's no longer a "delete/ remove sitemap" option on console? In which case, what happens to the old ones which will now 404? Thanks anyone for any insight you may have 🙂
Intermediate & Advanced SEO | | Fubra0 -
Please suggest! Overstuffed URLs - to change, or not to change?
Hello guys, We are in doubts about changing URLs on our http://www.fiberscope.net/ store The site was hit by Google in January and has dropped from top 3 to top 20 for most of its keywords. Now we're working on some redesign, including removing of over optimized content from it. It looks like our categories and content pages URLs are overstuffed with keywords. Here is a dilemma. Should we rewrite them and set up 301 redirect or just leave as is? I look trough the seomoz Q&A and find out that a lot of guys got in troubles after redirecting PLEASE, Suggest!
Intermediate & Advanced SEO | | Meditinc.com0 -
URL tracking on offline material
Hi there, Hope someone can give some advice. We are doing some magazine advertising, the main purpose of the advert is to promote one of our new products, however the URL goes something like this: http://www.domain.com/products/new-product-libra-furniture/ which is just too long for anyone to remember, I think it should be simply domain.com/libra which redirects to the product page, however how can I track this in Google Analytics? if using a 301 that's impossible? Any advice would be grateful.
Intermediate & Advanced SEO | | Paul780 -
Google Preview not showing images
No matter which our pages i find in the SERP the Google Preview does not show images for www.spies.dk Try searching for "rejser til malaysia" on google.dk. The result www.spies.dk/malaysia is not showing images. Why is that? Using the "google preview tool" under labs in Google Webmaster Tools sys it found 13 errors on that page: | Ressource: | Information: http://images2.spies.dk/images/SiteID11/SiteLayout/logo-spies.png?v=4 | Indekseret http://images1.spies.dk/images/StaticLayout/Spies_hori_sRGB.png?v=1 | Indekseret http://images1.spies.dk/images/SiteID11/Button/search-button-text3.png?v=2 | Indekseret http://images2.spies.dk/images/Country/my1001_10_48.jpg?v=1 | Indekseret http://images2.spies.dk/images/SiteID11/Button/Opdater_bt.png?v=2 | Indekseret http://images1.spies.dk/images/SiteID11/Button/Sog_bt.png?v=3 | Indekseret http://images2.spies.dk/images/Country/my1002_2_22.gif?v=1 | Indekseret http://images2.spies.dk/images/Resort/bkikki1001_4_11.jpg?v=1 | Indekseret http://images2.spies.dk/images/SiteID11/Button/Vaelg_bt.png?v=7 | Indekseret http://images1.spies.dk/images/Resort/bkiskn1001_4_11.jpg?v=1 | Indekseret http://images1.spies.dk/images/Resort/kulkum1001_4_11.jpg?v=1 | Indekseret http://images1.spies.dk/images/Resort/lgklak1001_4_11.jpg?v=1 | Indekseret https://track.adform.net/serving/scripts/trackpoint/async/ | Indekseret |
Intermediate & Advanced SEO | | alsvik0 -
Should I change Permalinks?
I have a site that is doing well in rankings, and its also been accepted in to Google news. I have around 800 article live on the site. My current permalink structure is - /%year%/%monthnum%/%postname%/ What I am wondering, would it be better to change it to - /%postname%/ The reason I ask is that most of the well ranking sites and sites built by SEO companies all seem to have the /%postname%/ Will I get a benefit from changing this? I know that I could republish content have the /%postname%/ permalinks. Are there any other benefits? If the is a benefit, I'd perefr to change it as soon as possible before the site grows even more Thanks in advance for anyone who can help
Intermediate & Advanced SEO | | JohnPeters0 -
URL for offline purposes
Hi there, We are going to be promoting one of our products offline, however I do not want to use the original URL for this product page as it's long for the user to type in, so I thought it would be best practice in using a URL that would be short, easier for the consumer to remember. My plan: Replicate the product page and put it on this new short URL, however this would mean I have a duplicate content issue, would It be best practice to use a canonical on the new short URL pointing to the original URL? or use a 301? Thanks for any help
Intermediate & Advanced SEO | | Paul780 -
Subdirectory URLs
If I have category pages for my site; is it better to use http://example.com/category/category or just http://example.com/category? Also, I'm creating a new section of the site; a resource center. Should the URLs of the pages in the resource center be http://example.com/learn/page or just http://example.com/page What are the reasons for the better choice?
Intermediate & Advanced SEO | | Visually0