WordPress.org

Ready to get started?Download WordPress

Forums

Permalinks "on" but images "gone" (4 posts)

  1. shyspeak
    Member
    Posted 7 years ago #

    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?

  2. thinkoholic
    Member
    Posted 6 years ago #

    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".

  3. hilj
    Member
    Posted 6 years ago #

    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.

  4. hilj
    Member
    Posted 6 years ago #

    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.

Topic Closed

This topic has been closed to new replies.

About this Topic