Support » Requests and Feedback » Default links to files could be done better…

  • For a long time I’ve wondered why wordpress creates links to files using the full URL instead of a relative URL. Today I just moved a site and had to get into the database and do something like:

    UPDATE wp_X_posts SET post_content = replace(post_content, “http://BLOG.DOMAIN/files”, “/files”);

    just to get all the images working again. I know in the case of blogs as subdirectories, you’ll still have to have something like /BLOG/files as the default location, but subdomains only need /files which would never change even when it gets moved.

    I guess this isn’t so much of a complaint as a suggestion… unless there’s a reason why relative URLs break other things.

Viewing 2 replies - 1 through 2 (of 2 total)
  • esmi


    Forum Moderator

    Try looking at where theme template files are stored and where plugins are stored and it becomes easy to see why trying to create relative urls in every situation would be a nightmare.

    I’m not sure what you mean… themes and plugins already are relative to your install and aren’t hardcoded or in the db anywhere AFAIK.

    I just mean the URLs to things that the media manager creates. It defaults to the domain path. I’ve done the above global replace on the database for 5+ blogs now and they all work fine with relative locations.

    When editing the site attributes I see that the Fileupload URL is set to http://BLOG.DOMAIN/files and I changed this to just /files

    I hope that does the trick.

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Default links to files could be done better…’ is closed to new replies.