Some content management systems (e.g. Typo3 or Multisite WordPress) need for proper function special type of link – symbolic link. They can be used to display the same website on several subdomains or even to make the website behave differently depending on the address in the address bar.
To create symlink we use the command ln. Syntax of the command is:
ln -s link_target link_name
In the example we will set a symlink from the subdomain blog.web-console.tld to be displayed on address web-console.tld/blog:
uid117660@shellserver:~$ cd web-console.tld/sub/ uid117660@shellserver:~/web-console.tld/sub$ ln -s ../web/blog blog uid117660@shellserver:~/wweb-console.tld/sub$ ls -l lrwxrwxrwx 1 uid117660 gid117660 11 Jul 24 16:45 blog -> ../web/blog drwxr-xr-x 3 uid117660 gid117660 4 Jul 24 16:25 wp
Two dots before the link target mean shift by one level up in directories. In the directory sub where we usually create subdomains is also the link blog targeting physical location web-console.tldeb/blog.
If you were not able to create the symlink or you have created symlink you don’t need, you can delete it with the command unlink:
uid117660@shellserver:~/web-console.tld/sub$ unlink blog uid117660@shellserver:~/web-console.tld/sub$ ls wp