WordPress.org

Support

Support » How-To and Troubleshooting » Permalinks “on” but images “gone”

Permalinks “on” but images “gone”

  • I activated permalinks and now all images “can’t be found on this server” although I haven’t changed the URL (e.g. “domain_name/wp-images/file_name.jpg” to the image, the server looks for the permalink (e.g. “domain_name/2007/06/14/post_name/wp-images/file_name”); also pervious pages can’t be opened for the same reason.

    Any insight?

Viewing 3 replies - 1 through 3 (of 3 total)
  • thinkoholic
    Member

    @thinkoholic

    i had the same problem, using images with relative URIs.

    the first solution (which i found somewhere on here):
    use absolute URIs – like <img src=”/folder/file.jpg”> instead of <img src=”folder/file.jpg”> (note the slash after src=”!)

    the second solution would be to add the following lines to wordpress/wp-includes/formatting.php (in line 28):

    $curl = str_replace(‘src=”‘, ‘src=”/’, $curl);
    $curl = str_replace(‘src=”/http://’, ‘src=”http://’, $curl);
    `

    using the second solution, you can keep linking as before, and the changes will be made automatically (and retroactively). external links are “cleaned” of the preceding “root-slash”.

    I have a similar problem. I built my wp site locally. When I (idiot) added the photos to the site like shown below:

    http://localhost:8888/wordpress/wp-content/uploads/2007/12/image.jpg

    Theres lot of photos, it’ll be a tedious task for me to chance all of them. Can I use the code mentioned upper to get it done somehow? To replace the http://localhost:8888?

    Thank you.

    Always posting too hastily.

    I found the following to work in my case:

    $curl = str_replace('src="http://localhost:8888/wordpress','src="/wptest', $curl);

    Just checking that is it done correctly? It works though.

    Cheers.

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Permalinks “on” but images “gone”’ is closed to new replies.