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
-
Lazy loading images
Hello, Currently we are working on a new website. Within this new website we have the option to lazy load the images. My question regarding this: will this cause any SEO problems? Will google detect / see all images properly? If not, how can we make sure that google does? Thanks in advance! Remco
Intermediate & Advanced SEO | | AMAGARD0 -
Tools to test meta descriptions?
Hey does anyone know of any tools which can test your meta descriptions against competitors meta descriptions for specific keyword terms. I know one tool called SERP Turkey which uses mechanical turk, i was wondering if there is any others on the market? Even a tool which can automatically score your meta description against others on the SERP results page. E..g optimised, keyword, call to action, etc. Cheers, Chris
Intermediate & Advanced SEO | | jayoliverwright0 -
Duplicate content when changing a site's URL due to algorithm penalty
Greetings A client was hit by penguin 2.1, my guess is that this was due to linkbuilding using directories. Google webmaster tools has detected about 117 links to the site and they are all from directories. Furthermore, the anchor texts are a bit too "perfect" to be natural, so I guess this two factors have earned the client's site an algorithm penalty (no manual penalty warning has been received in GWT). I have started to clean some of the backlinks, on Oct the 11th. Some of the webmasters I asked complied with my request to eliminate backlinks, some didn´t, I disavowed the links from the later. I saw some improvements on mid october for the most important KW (see graph) but ever since then the rankings have been falling steadily. I'm thinking about giving up on the domain name and just migrating the site to a new URL. So FINALLY MY QUESTION IS: if I migrate this 6-page site to a new URL, should I change the content completely ? I mean, if I just copy paste the content of the curent site into a new URL I will incur in dpolicate content, correct?. Is there some of the content I can copy ? or should I just start from scratch? Cheers hRggeNE
Intermediate & Advanced SEO | | Masoko-T0 -
Bad site migration - what to do!
Hi Mozzers - I'm just looking at a site which has been damaged by a very poor site migration. Basically, the old URLs were 301'd to a page on the new website (not a 404) telling everyone the page no longer existed. They did not 301 old pages to equivalent new pages. So I just checked Google WMT and saw 1,000 crawl errors - basically the old URLs. This migration was done back in February, since when traffic to the website has never recovered. Should I fix this now? Is it worth implementing the correct 301s now, after such a timelapse?
Intermediate & Advanced SEO | | McTaggart0 -
Does having a trailing slash make a url different than the same url without the trailing slash?
Does having a trailing slash make a url different than the same url without the trailing slash? www.example.com/services Or www.example.com/services**/** Does Google consider these to be the same link or does Google treat them as different links?
Intermediate & Advanced SEO | | webestate0 -
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 -
Strategies in Renaming URLs
We're renaming all of our Product URLs (because we're changing eCommerce Platforms), and I'm trying to determine the best strategy to take. Currently, they are all based on product SKUs. For example, Bacon Dental Floss is: http://www.stupid.com/fun/BFLS.html Right now, I'm thinking of just using the Product name. For example, Bacon Dental Floss would become: http://www.stupid.com/fun/bacon-dental-floss.html Is this strategy the best for SEO? Any better ideas? Thanks!
Intermediate & Advanced SEO | | JustinStupid0 -
Url with hypen or.co?
Given a choice, for your #1 keyword, would you pick a .com with one or two hypens? (chicago-real-estate.com) or a .co with the full name as the url (chicagorealestate.co)? Is there an accepted best practice regarding hypenated urls and/or decent results regarding the effectiveness of the.co? Thank you in advance!
Intermediate & Advanced SEO | | joechicago0