---
description: >-
  https://www.craiglotter.co.za/2014/11/25/xampp-and-windows-how-to-create-a-symbolic-link/
---

# TIPS, TRICKS AND TUTORIALS XAMPP and Windows: How to Create a Symbolic Link (ok)

<figure><img src="https://1592565776-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-LVfVRgKBlsVnWvhnDaa%2Fuploads%2FC4xX1euKFNP1ObMuUy8G%2Fimage.png?alt=media&#x26;token=18ed2898-e8f0-4a8d-93b7-9273ae023ddf" alt=""><figcaption></figcaption></figure>

<figure><img src="https://1592565776-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-LVfVRgKBlsVnWvhnDaa%2Fuploads%2FyuWF8ImWKYyJz1m3CBGy%2Fimage.png?alt=media&#x26;token=651fe3d0-88a9-44ba-8b56-579185238ae0" alt=""><figcaption></figcaption></figure>

<figure><img src="https://1592565776-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-LVfVRgKBlsVnWvhnDaa%2Fuploads%2FHR1rm3tY0lnqJKym2T64%2Fimage.png?alt=media&#x26;token=92787b31-dedc-4e7d-afb2-137e2fb39390" alt=""><figcaption></figcaption></figure>

<figure><img src="https://1592565776-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-LVfVRgKBlsVnWvhnDaa%2Fuploads%2FqfxZLGJ9zkosJPNHg6pH%2Fimage.png?alt=media&#x26;token=767d013e-3fb9-4df2-8ae0-c77d5f21f983" alt=""><figcaption></figcaption></figure>

<figure><img src="https://1592565776-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-LVfVRgKBlsVnWvhnDaa%2Fuploads%2FDlxME7lsRotHG2SWaaoG%2Fimage.png?alt=media&#x26;token=3312ea40-a524-4004-bb53-f4b0bf1716e3" alt=""><figcaption></figcaption></figure>

## Thật vi diệu code đặt ở một nơi và lại được sử dụng một nơi&#x20;

## XAMPP and Windows: How to Create a Symbolic Link

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.

[![xampp logo](https://www.craiglotter.co.za/wp-content/uploads/2014/11/xampp-logo.jpg)](https://www.craiglotter.co.za/wp-content/uploads/2014/11/xampp-logo.jpg)
