SitePoint Sponsor

User Tag List

Results 1 to 2 of 2
  1. #1
    SitePoint Evangelist hessodreamy's Avatar
    Join Date
    Apr 2005
    3 Post(s)
    0 Thread(s)

    Symbolic link if file doesn't exist - is this possible

    I'm setting up a test subdomain on my server to test changes. I'll be copying over the php files from my main site. However there's a lot of pictures (product pictures, mostly) on the site so I don't want to just copy them over and hog hard drive space. I could just symbolic link the images directory to the images directory on the live site (they're on the same server) however some of the things I might be testing are filesystem changes to files in the images directory (creating, deleting, edit images etc) that I don't want reflected on the live site.

    I could use mod rewrite to check if an image exists and, if it doesn't, serve the appropriate image from the main site (at least I think that's possible), but if it's doing that with a lot of pictures on the page I reckon this would be really slow, and it also doesn't help me with file system access to the files (eg accessing image dimensions via php for example).

    Is what I'm asking for do-able? Is a mass copy of the image directory a more accepted solution?

  2. #2
    Certified Ethical Hacker silver trophybronze trophy dklynn's Avatar
    Join Date
    Feb 2002
    19 Post(s)
    3 Thread(s)

    -l is the if symbolic link shortcut but that's not what you're after. -f will test the {REQUEST_FILENAME} to see if it exists as a file then you'll need to run your link in the redirection.

    IMHO, the cleaner way should be to either copy all the files (actually, just the ones you want to play with) OR link to them with an external link (if not in the same domain's webspace).


    David K. Lynn - Data Koncepts is a long-time WebHostingBuzz (US/UK)
    Client and (unpaid) WHB Ambassador
    mod_rewrite Tutorial Article (setup, config, test & write
    mod_rewrite regex w/sample code) and Code Generator


Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts