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

freemium's avatar

link domain and sub domain storage path

like main site is on example.com and admin portal is in admin.example.com , when i do crud from admin.example.com file should be stored/updated/deleted/fetched at example.com directory how can i create symlink or achive like that... i am using shared shared hosting how can i achive that example.com=> /home/username/public_html directory admin.example.com=>/home/username/admin/admin_directory

please help some body

0 likes
6 replies
freemium's avatar

@martinbean

what i did was

 Route::get('/link', function () {
        $target = '/home/user12/test/mainsite/storage/app/images';
        $shortcut = '/home/user12/test/adminsite/public/images';
        symlink($target, $shortcut);

it created symlink but when i upload product it gets stored in adminsite directry i wanto store in and retrive from mainsite directory

freemium's avatar

@martinbean

how can i symlink

 $target = '/home/user12/public_html/storage/app/images';
        $shortcut = '/home/user12/test/adminsite/public/images';

can you illustrate with code please i did lot of research and i couldnot found...

frankielee's avatar

@freemium

From the link provided by @martinbean, you just need to add your configuration to the array

Example:

	'links' => [
		public_path('storage') => storage_path('app/public'),
		'target location'=>'source location',
        public_path('images')=>'/home/user12/test/adminsite/public/images',
	],

After that, running the command php artisan storage:link will create the symlink folder based on the array.

Please or to participate in this conversation.