😂TIPS, TRICKS AND TUTORIALS XAMPP and Windows: How to Create a Symbolic Link (ok)
https://www.craiglotter.co.za/2014/11/25/xampp-and-windows-how-to-create-a-symbolic-link/
Last updated
https://www.craiglotter.co.za/2014/11/25/xampp-and-windows-how-to-create-a-symbolic-link/
Last updated
November 25, 2014 By Craig Lotter No Comments
If you have scripts which need to be run in your local web browser but fall outside of your web root or any other declared vhost directory, there is always the option of simply creating symbolic links to these external locations from within your web root folder.
To do this (and I needed to on my Windows 7 environment to get around some Sencha ajax origin restrictions during debugging) follow the following steps:
1. Click the Start button to bring up the start menu.
2. Type cmd in the universal search box at the bottom of the start menu. (You should see at the top of the search results under Programs cmd.exe highlighted)
3. Press the Ctrl + Shift + Enter to launch the command prompt (cmd.exe) as Administrator. If you don’t do this, you’ll get a error saying that there are insufficient permissions to create the symbolic link later on. (You can also right click and select “Run as Administrator” to achieve the same thing.)
4. A box saying “Windows needs your permission to continue” will pop up. Click Continue.
5. Go to the directory you want to create the link in. For example: cd c:\xampp\htdocs\
6. Use mklink to create your symbolic link (or shortcut):
1
mklink /D externalfolder "c:\Users\username\Documents\My Folder\"
Note: The /D is there because, in this example, we are linking to a directory. “externalfolder” is the name of the symbolic link (change to whatever you want). Finally, the path is where the symbolic link actually resolves to.
Using the example laid out below, we could now point our browser to http://localhost/externalfolder/hello-world.php which would run just fine, with the browser executing c:\Users\username\Documents\My Folder\hello-world.php in reality.
Useful little trick to be aware of.