WordPress.org

Ready to get started?Download WordPress

Forums

images not to use static link (3 posts)

  1. bp0612
    Member
    Posted 1 year ago #

    i have images stored in uploads and the person developed the site has images following full links and i want to insted use path.

    here is the code i have in the page when i switch to Text view.

    [frame link="http://dev.site.com/wp-content/uploads/Day1-E-39.jpg" linking="lightbox" align="left" type="simple"][flex_slider width="614" ]http://dev.site.com/uploads/Day1-P-group.jpg
    [/flex_slider][/frame]

    and my site will be http://www.site.com at some point and i dont want to go in each page and change that static link.
    anyway to make it so that whatever links i have on devlopment server when i upload it points to the correct file.

  2. MisterManu
    Member
    Posted 1 year ago #

    I'm not sure if this will help but If you know some SQL you could do that:
    Open phpMyAdmin on your server (live or local), and export the database, making sure to select all tables and to save it as a file. Go to your live server, and import the .sql file that you just saved. In the top menu, click on the tab for “SQL,” whereupon you will see a text area. You will need to enter some query syntax; be sure to replace the URLs in these code fragments with the ones that pertain to your set-up — namely.

    Replacing WordPress’ base URL path:
    UPDATE wp_options SET option_value = replace(option_value, 'http:// localhost:8888/wordpress ', '') WHERE option_name = 'home' OR option_name = 'siteurl';
    Update the GUID that controls WordPress’ translating paths and post locations:
    UPDATE wp_posts SET guid = REPLACE (guid, 'http://localhost:8888/ wordpress ', '');
    Update the URL paths in the content:
    UPDATE wp_posts SET post_content = REPLACE (post_content, 'http:// localhost:8888/wordpress ', '');
    Update the URLs in the meta data of posts, such as attachments:
    UPDATE wp_postmeta SET meta_value = REPLACE (meta_value, 'http:// localhost:8888/wordpress ','');

  3. MisterManu
    Member
    Posted 1 year ago #

    If this doesn't work for you or is too complicated, I've read that somewhere:

    BRINGING IN EVERYTHING
    I use this method if I have done everything locally from the ground up. I’ll upload my entire local WordPress directory (in this case, http:// localhost:8888/wordpress) to the live server and then grab the database file and transfer that from local to live as well.
    Because you could certainly build nearly the entire website in your development environment, bear in mind that WordPress uses absolute paths for URLs. So, every image and link will be prepended with http:// localhost:8888/ (depending on your set-up). We need a way to alter this to fit the live website. We have a few options.
    1. EXPORT, SEARCH AND REPLACE
    Using this method, we export our local database as a text file and run a “Find and replace” on the text to replace all occurrences of the localhost URL with the production URL.
    Begin by opening phpMyAdmin and clicking on your WordPress database on the left. Click on the “Export” tab in the top menu, and be sure to choose “Select all” when choosing which tables to export. At the bottom, check the box to “Save as file,” and then hit “Go.” Open the resulting file in your favorite text editor, and simply run a “Find and replace” to replace all instances of http://localhost:8888/wordpress with http:// http://www.YOUR_SITE_URL.com.

    This is taken from WordPress essentials for beginners, Ebook by Smashing Magazine

Topic Closed

This topic has been closed to new replies.

About this Topic