Using Script Directory and It's Subdirectories Outside of DocumentRoot

Posted on 2006-04-04
Medium Priority
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\
NEW SITES SCRIPTS URL: http://www.newsite.com/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
  • 2
  • 2
LVL 27

Expert Comment

ID: 16379382
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

ID: 16381500
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

ID: 16395361
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

caterham_www earned 1500 total points
ID: 16399445
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 Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

In my time as an SEO for the last 2 years and in the questions I have assisted with on here I have always seen the need to redirect from non-www urls to their www versions. For instance redirecting http://domain.com (http://domain.com) to http…
As Wikipedia explains 'robots.txt' as -- the robot exclusion standard, also known as the Robots Exclusion Protocol or robots.txt protocol, is a convention to prevent cooperating web spiders and other web robots from accessing all or part of a websit…
Integration Management Part 2
With just a little bit of  SQL and VBA, many doors open to cool things like synchronize a list box to display data relevant to other information on a form.  If you have never written code or looked at an SQL statement before, no problem! ...  give i…
Suggested Courses
Course of the Month15 days, left to enroll

840 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