• Hello

    If I get (with backup) the site in localhost and adjust the 2 url for localhost in general settings
    all images retain the url of the remote server ! everything is wrong ! If I delete the temporary site on remote server all the pictures are gone

    how can you set a non https:// url for medias ?

    it must be ./wp-content/upload/images.jpg and not at all https://domain.com=/wp-content/upload/images.jpg

    thank you

Viewing 3 replies - 1 through 3 (of 3 total)
  • you will need to open your backup .sql file in notepad and do a search -> replace on localhost url to hosted url as image url’s get hard-coded in the db

    Thread Starter polpaulin

    (@polpaulin)

    is it the only way to do that with wordpress ??
    there is not way to store in the database relative paths ?

    then it is a toy not a serious CMS

    thanks but I cant believe there is no other ways , no pro users will do that

    Thread Starter polpaulin

    (@polpaulin)

    this can help someone, if you see any table and/or and field missing in the replacement please tell me

    DELIMITER //
    
    CREATE PROCEDURE sp_replace_DL ()
    
    BEGIN
    
    SET @l=  'https://localhost:8888/website';
    SET @d=  'https://website.com';
    
    UPDATE wp_options wo  SET wo.option_value = REPLACE ( wo.option_value , @d, @l);
    
    UPDATE wp_postmeta wm  SET wm.meta_value = REPLACE ( wm.meta_value , @d, @l);
    
    UPDATE wp_posts wp  SET wp.post_content = REPLACE ( wp.post_content , @d, @l) , wp.guid = REPLACE ( wp.guid , @d, @l), wp.post_content_filtered= REPLACE ( wp.post_content_filtered , @d, @l) ;
    
    UPDATE wp_usermeta wum  SET wum.meta_value = REPLACE ( wum.meta_value , @d, @l);
    
    SET @lh=  '/www/website';
    SET @dh=  '/home/website/public_html/';
    
    UPDATE wp_options wo  SET wo.option_value = REPLACE ( wo.option_value , @dh, @lh);
    UPDATE wp_postmeta wm  SET wm.meta_value = REPLACE ( wm.meta_value , @dh, @lh);
    UPDATE wp_usermeta wum  SET wum.meta_value = REPLACE ( wum.meta_value , @dh, @lh);
    
    END //
    
    DELIMITER ;
    
    -- CALL sp_replace_DL()
Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘wrong images url after distantlocal’ is closed to new replies.