Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

smacy's avatar
Level 1

sharing storage path between domain and sub domain

i have two project on shared hosting one admin panel and another website . main site is on /public_html directory and another on /admin/adminsection all the file need to fetched and upload in /public_html laravel project directory where main site is hosted.

like main site :example.com located at public_html like admin site at admin.example.com when i upload file from admin.example.com file should stored in example.com storage_path and also fetched from example.com storage_path how can i do that

0 likes
8 replies
jeevamugunthan's avatar

Why you are storing the file in example.com ? you can show the files in example.com from the subdomain.

smacy's avatar
Level 1

@jeevamugunthan

for example i can have many server one for web application one for mobile api one for admin portal and all there should have file stored in either of server

s4muel's avatar

@smacy on linux:

ln -s /path_to_main_site/storage/app/public/ /path_to_admin_subsite/storage/app/public/

note: the admin subsite's storage/app/public should already be a target of another symlink from public/storage

smacy's avatar
Level 1

@s4muel i am on windows i couldnot get exactly

        public_path('storage') => storage_path('app/public'),

what could be like this ...i am pretty new to laravel so please help me

s4muel's avatar

@smacy first remove the folder /path_to_main_site/storage/app/public/ completely in your admin subsite and then edit your links in filesystems configuration file for admin subsite like this:

'links' => [
    storage_path('app/public') => '/path_to_main_site/storage/app/public/',
    public_path('storage') => storage_path('app/public'), //should be already there
],

then run php artisan storage:link in the admin subsite. but no guarantee, just try that and you will see

Please or to participate in this conversation.