-1

I created a site on a testing server on my local Windows machine, and now I wish to port it to a remote server which is Linux. Both sites running under Apache.

To create symlinks on Windows, is stopped the server, and used mklink /d source destination, and I was careful to use relative syntax - eg. ..\imgdir instead of C:\htdocs\imgdir. I don't know if that matters, but it made sense in my brain. Started the server, symlinks work fine.

However, when I upload the site with FTP, the symlinks are gone. The folders just disappear. Is this to be expected? Is there are solution?

dgo
  • 133
  • 10

1 Answers1

4

This is expected behavior - FTP doesn't know anything about symlinks and cannot create them - it operates on regular files and directories. Even if supported, I don't really see how it will work. Windows symlinks are different from linux symlinks.

GioMac
  • 4,544
  • 4
  • 27
  • 41
  • This is what I feared. Makes a cross platform testing server seem like a bad idea. Here's a weird twist though: I made up a quick test the first time I tried it. I made a directory structure like `1/2/3/4/5`, and then in `5` created a symlink to `../../3`. I uploaded that, and that worked: sort of. It created an infinitely recursive directory on Linux. – dgo Sep 08 '13 at 13:02
  • cross platform testing isn't bad idea in this case. using symlinks with web is a bad idea, most of the hosting providers won't allow web server to follow symlinks. – GioMac Sep 08 '13 at 13:04
  • use .htaccess/mod_rewrite to forward requests – GioMac Sep 08 '13 at 13:05
  • I think I'll just create a shell script to recreate the links. – dgo Sep 08 '13 at 14:07
  • Bad way. Use rewriting rules. Symlinks aren't available everywhere. – GioMac Sep 08 '13 at 17:16
  • mod_rewrite is something I have no experience with. If I wanted to write a mod_rewrite script to point the source of all imgs to a global image directory,how would I do that. Also, can this be done with the css files as well? (background-images) – dgo Sep 09 '13 at 16:27
  • Yes, you can do it with anything, according to RegEx you want – GioMac Sep 11 '13 at 19:25