There several ways to create a symlink on our Shared Cpanel servers.
1. You can create a symlink via SSH. To make sure your plan supports it and to be enabled for your user, please contact our Technical Department HERE
Once enabled you can create symlinks using the following command as an example:
ln -s /path/to/target /path/to/shortcut
2. You can also create a symlink using the PHP function.
- To do that login via the File Manager and click on File.
- Name your php-script (example: symlink.php) and click Create New File.
- Right-click on the file and choose Edit.
- Add the following code below:
$target = '/home/cPanelusername/public_html/index.html';
$shortcut = 'script.html';
NOTE: $target and $shorcut are variable that you need to change as per your requirements.
- Click Save Changes and run this PHP file in the browser and it will create symlink right away.
NOTE: Creating symlinks to root directories of other websites may cause serious security breaches, that's why we highly recommend using symlinks only for those folders that do not expose any config or system files, as, if acquired, such files may be used for hacking or other malicious activity.