I have blog on www.mydomain.com
however, I wanted to move it on www.mydomain.com/blog
In some posts I have images embedded like:
< img src=”/wp-content/uploads/2009/11/image.jpg” style=”height: 200px; float: left; margin: 10px” >
But when I move it to www.mydomain.com/blog these photos surely won’t display cause the photo will be in:
www.mydomain.com/blog/wp-content/uploads/2009/11/image.jpg and this src will mean that it’s in www.mydomain.com/wp-content/uploads/2009/11/image.jpg, what is not true.
How can I set the relatives paths of these photos so that after changing the destination of my blog they still will be displayed?
Greetings!
edit:
stackoverflow cut html tags so I wrote them once again, sorry
once you move your blog over, do a find and replace on the mysql database tables for the links.
Anywhere it sees .com/wp-content/ change it to .com/blog/wp-content/
I use this plugin.
http://wordpress.org/extend/plugins/search-and-replace/
this is an old post but I answer anyway, because it can help someone else.
First, you in fact asked how to make relative paths: but that’s not a good thing, for a couple of reasons:
1 not good for search engines: that’s because you end up with a resource that is not unique
2 not good for plugins: that’s because the thing can generate compatibility problems
I found that its probably better (faster and doesn’t require plugins) do a find&replace via SQL, since it’s a really simple command:
I had the problem that I develop sites locally.
Here’s a ‘for dummies’ explanation of the command. With this command, you simply say:
1 go to table named wp_posts (the table where wordpress saves all kind of posts and pages)
2 take a look to the post_content column (the column that contains the post contents)
3 replace any string that is like ‘http://localhost:8888’ with ‘new domain’ (well, not ‘new domain’ literally, instead, your domain)
That’s all. You can do this in phpMyAdmin: click on the sql tab and type in the sql.
It’s quite hard to do it wrong, but anyway, always make a backup of the database first.
hope it helps.
P.s.
As said, the original question could be a sort of duplicate, but not exaclty, since it’s about relative paths, not path substitution. This answer instead, can in fact answer the ‘duplicated’ question. But I posted it here to take the people who (as me some time ago) wants relative paths and don’t know thei’re not good, to the right fix of the problem.