There are many different options:
1) Define an ALIAS in httpd.conf which points to the new drive. You can then link to media files using that ALIAS. Example:
- Code: Select all
ALIAS /mydrive d:/mymedia
And in your PHP Script or HTML Documents you can link to media on that drive via:
- Code: Select all
http://localhost/mydrive/myvideo.mpg
The above link yield to d:/mymedia/myvideo.mpg
2) Or, a little more sophisticated, define a new VirtualHost, which holds the new drive as DocumentRoot. Keep in mind, if you define any VirtualHost, you MUST define ALL servernames (i.e. localhost) as VirtualHosts. Example:
- Code: Select all
<VirtualHost *:80*>
Servername mymedia.local
DocumentRoot "d:/mymedia"
...
</VirtualHost>
If you do so, you also have to apply an entry for mymedia.local in every hosts file of your environment, in Xampp Server PC, in each client PC etc., which assigns mymedia.local to the LAN IP of the Xampp PC.
- Code: Select all
192.168.1.123 mymedia.local
where 192.168.1.123 is meant to be the LAN IP of the Xampp PC.
You finally can assign a media file via this URL:
- Code: Select all
http://mymedia.local/myvideo.mpg
3) Last not least, you could also simply create a "symbolic link" from your new hard drive into the htdocs folder of your Xampp PC. In Windows 10 there is a command (to be used in a Terminal) called "mklink". You can create a symbolic link to your new drive like this for example:
- Code: Select all
mklink c:/xampp/htdocs/mydrive d:/
You will find the contents of the new drive d: then also under c:/xampp/htdocs/mydrive and can also create URLs which point to that folder. Apache must be told to follow those symbolic links, you have to add the option "FollowSymLink" in you configuration of the DocumentRoot. Probably there is already such an option per default in your Xampp configuration. See the <Directory "c:/xampp/htdocs"> configuration in your Xampp httpd.conf. Finally that results in URLs like this:
- Code: Select all
http://localhost/mydrive/mymedia/myvideo.mpg
A last hint: A drive letter like d: is only known to the currently logged in User (your UserID). If you run Apache as a service (which you can opt for in the Xampp DIalog), Apache is NOT executed by your UserID, instead it is started at boot time by User "System". At that time and for this User there is no drive letter D:, therefore Apache will fail to connect to the new drive. You have to start Apache manually instead of starting it at boot time and also do NOT run Apache as a service. You can remove the "x" in the option dialog for running Apache as a service in the Xampp DIalog.
Instead you can avoid using drive letters, use the so called UNC Pathname of your Drive. That is the name of the WIndows Share and usually looks like \\mydrive\mymedia or similar. Finally keep in mind, that Apache must have appropriate rights to read from that drive. If it is a NAS, you have to assign certain rights in the setup of the NAS.