Linking to Network Files in Wordpress Intranet

Problems with the Windows version of XAMPP, questions, comments, and anything related.

Linking to Network Files in Wordpress Intranet

Postby edisondude » 24. August 2018 02:53

I am using Wordpress and Xampp for a business intranet; It is not accessible from only inside the company network. I want individuals to be able to click a link and open files from "//servername/folder/file.pdf" or similar.

When I use file:// or file:/// or file:///// it does not work from wordpress. Are there settings I need to change in .htaccess or some other file?

I can put a HTML file on my computer desktop and it works, but if I use the same HTML code in Wordpress, it does not work, so it must be an access, or permission or setting of some sort.

Any ideas? Suggestions?
edisondude
 
Posts: 2
Joined: 24. August 2018 02:51
XAMPP version: 7.2.8
Operating System: Windows 10

Re: Linking to Network Files in Wordpress Intranet

Postby Nobbie » 24. August 2018 11:11

Ask in a Wordpress forum? I have no idea how WordPress works.

P.S::
Code: Select all
 I want individuals to be able to click a link and open files from "//servername/folder/file.pdf" or similar.


Lets forget about wordpress (i dont know if there is any special configuration for wordpress), but from the view of Apache and TCPIP, you have to do the following configuration:

Edit Apache configuration (I.e. httpd.conf or so) and apply a VirtualHost for "servername":

Code: Select all
<VirtualHost *:80>
ServerName servername
DocumentRoot //servername/share/
<Directory //servername/share/>
Require All Granted
</Directoy>
</VirtualHost>


Of course you may enter lots more options into that VirtualHost, but this is the minimal declaration.

//servername/share must be a valid Server / Windows share in your network (which points to any valid PATH on servername), there you can create your "folder" and put the file file.pdf. Keep in mind that Apache process must have sufficient rights to access //servername/share. Finally you put the file under //servername/share/folder/file.pdf but must be linked as http://servername/folder/file.pdf.

P.P.S.: Maybe i got it wrong, of course you also simply can provide a file from C: drive (instead from a Windows Share, which is very sophisticated), simply apply another DocumentRoot:

Code: Select all
<VirtualHost *:80>
ServerName servername
DocumentRoot c:/myfiles
<Directory c:/myfiles>
Require All Granted
</Directoy>
</VirtualHost>


Then simply create a folder "folder" in c:/myfiles and put file.pdf there, then also link to http://servername/folder/file.pdf. If servername is NOT the Windows Server Name for the Xampp PC, you have to apply servername to all(!) hosts files in your network PCs. I.e:

Code: Select all
192.168.1.2   servername
Nobbie
 
Posts: 13179
Joined: 09. March 2008 13:04

Re: Linking to Network Files in Wordpress Intranet

Postby edisondude » 02. September 2018 03:52

Thanks Nobbie! Took me some time to work thru different ways, but figured it out with your help!

Ended up using:
Alias "/server1/" "//server1/"
<Directory "//server1">
Require all granted
</Directory>

also had to change:
<Directory />
#AllowOverride none
#Require all denied/>
AllowOverride all
Require all granted
</Directory>


since its all behind the firewall, not concerned about permissions...for now.
edisondude
 
Posts: 2
Joined: 24. August 2018 02:51
XAMPP version: 7.2.8
Operating System: Windows 10


Return to XAMPP for Windows

Who is online

Users browsing this forum: No registered users and 192 guests