Skip to content

[5.x]: Asset not accessible from defined URL when the URL is different from filepath #18956

@foxtrotcz

Description

@foxtrotcz

What happened?

Description

I cant access assets if I set Base URL of filesystem different than actual filepath or not in public web folder.

Example1

  1. Lets say I have web www.example.com and alias @myweb.
  2. Create new Local Folder filesystem with settings:
    Base URL: @myweb/test1
    Base Path: @webroot/test2
    Enable: Files in this filesystem have public URLs
  3. Create simple Volume using this filesystem. No need to add subpath.
  4. Upload example image.png to this volume.
  5. Try accessing this example image.

Expected behavior: Image accessed on www.example.com/test1/image.png

Actual behavior: Image is not accessible on above URL (shows 404) but instead on www.example.com/test2/image.png

Example2

  1. Same
  2. Create new Local Folder filesystem with settings:
    Base URL: @myweb/test1
    Base Path: @storage/test2
  3. Same
  4. Same
  5. Same

Expected behavior: Image accessed on www.example.com/test1/image.png

Actual behavior: Image is not accessible, shows 404.

Craft CMS version

5.10.3

PHP version

No response

Operating system and version

No response

Database type and version

No response

Image driver and version

No response

Installed plugins and versions

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions