Make WordPress Core

Opened 7 years ago

Closed 7 years ago

#42312 closed enhancement (duplicate)

store file path should not include host name

Reported by: ravi500patel's profile ravi500patel Owned by:
Milestone: Priority: normal
Severity: normal Version: 4.8.2
Component: Upload Keywords: reporter-feedback
Focuses: Cc:

Description

Right now when we upload file it store full path of file with host name.
So when you work on local server and then upload site to live we have to change all url of file path to live server.

Change History (3)

#1 @SergeyBiryukov
7 years ago

  • Keywords reporter-feedback added

Hi @ravi500patel, thanks for the report!

WordPress does not store full paths to uploaded files since version 2.8. They are stored as relative paths in the database.

Does it still happen with all plugins disabled and a default theme (Twenty Seventeen) activated? Could you provide the steps to reproduce the issue on a clean install?

#2 @ravi500patel
7 years ago

Hi,
I am saying my attachment guid for uploaded file in wp-posts table is http://localhost/wordpress/wp-content/uploads/2017/08/image.jpg

So instead of full path if it store uploads/2017/08/image.jpg then it would more easy when you upload to live or change domain

#3 @dd32
7 years ago

  • Milestone Awaiting Review deleted
  • Resolution set to duplicate
  • Status changed from new to closed

The GUID is intentionally a full URI, and is not intended to be used as a public URL to a resource. The GUID is specifically a globally-unique value and could be realistically sha1( get_permalink() ) instead.

I'm going to mark this as a duplicate of #6492 which although not an exact duplicate, covers the same basic thing. There's a bunch of other similar tickets marked as duplicates of that too.

Note: See TracTickets for help on using tickets.