Using Script Directory and It's Subdirectories Outside of DocumentRoot

Posted on 2006-04-04
Last Modified: 2010-03-04
I just ditched IIS for Apache and I'm thrilled with the results except for this one issue. First, some background. I had a script powering multiple sites. The script was stored here:

OLD SITE: c:\inetpub\oldsite\script-directory\script-subdirectories

I created a few more sites and used the same scripts for content management. To do this, I created a virtual directory pointing to the old-site's script directory:

NEW SITE: c:\inetpub\newsite
NEW SITES SCRIPTS DIR:  c:\inetpub\oldsite\script-directory\
Since then I've tried creating a ScriptAlias in the Apache conf file. This let's me run scripts in "c:\inetpub\newsite", but those scripts can't access the sub-directories. The sub-directories contain images, stylesheets, supporting files, etc.  Here's what that line looks like:

ScriptAlias /script-directory "c:\inetpub\oldsite\script-directory"

How do I make it so that all of the sub-directories under "c:\inetpub\oldsite\script-directory" are accessible as well from the new site?

I really appreciate your help. Thanks!
Question by:EdelmanPlumbing
    LVL 27

    Expert Comment

    Try to use a normal alias instead, otherwise I think your images in c:\inetpub\oldsite\script-directory\folder\aaa.jpg are treated as cgi-script as well.

    Alias /script-directory "c:/inetpub/oldsite/script-directory"
    <Directory "c:/inetpub/oldsite/script-directory">
    Options ExecCGI
    # only this extensions are treated as cgi-script
    AddHandler cgi-script .cgi .pl

    Author Comment

    Caterham, that looks like the "best practices" way to access the scripts in "c:/inetpub/oldsite/script-directory". Unfortunately, that doesn't let me access the the sub-directories of script-directory. Is there a way to use the Directory command to tell the webserver to process requests in all the sub-directories as well?

    Author Comment

    I was working on another problem when I came across the right answer. It's funny how not working on something can get things done faster!

    <Directory "c:/inetpub/oldsite/script-directory">
      Options +ExecCGI +FollowSymlinks
      AddHandler cgi-script .cgi .pl

    Alias /script-directory "c:/inetpub/oldiste/script-directory"
    LVL 27

    Accepted Solution

    Is it working now?

    > Unfortunately, that doesn't let me access the the sub-directories of script-directory.

    And what response did you get from apache? Anything logged in your error.log?

    Featured Post

    Free Trending Threat Insights Every Day

    Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

    Join & Write a Comment

    Suggested Solutions

    Title # Comments Views Activity
    Run PHP Script in Background on Page Return 12 118
    XAMPP / PHPmyadmin 5 59
    Apache 2.2 on Windows 2008 32 43
    Best IDE for PHP starters 10 63
    Hi, in this article I'm going to teach you how to run your own site, and how to let people in (without IP). I'll talk about and explain each step... :) By the way, everything in this Tutorial is completely free and legal. This article is for …
    It is possible to boost certain documents at query time in Solr. Query time boosting can be a powerful resource for finding the most relevant and "best" content. Of course the more information you index, the more fields you will be able to use for y…
    It is a freely distributed piece of software for such tasks as photo retouching, image composition and image authoring. It works on many operating systems, in many languages.
    This video is in connection to the article "The case of a missing mobile phone (". It will help one to understand clearly the steps to track a lost android phone.

    731 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    16 Experts available now in Live!

    Get 1:1 Help Now