Forum Moderators: phranque
/html/index.htm (site home page)
/stuff/pics/sample.jpg
Is this good practice for non-executable files, and is there an alias or rewrite command that will let the html pages request these? The developer was working in a subdirectory, so the image and other links are in the form of ../stuff/pics/sample.jpg. This worked fine while the site was in a subfolder on a larger site. Once the html folder becomes document root on its own domain, though, the links don't work.
The alternative is to move the files into the document root and change the references. Some of this can be automated, but some script editing may be needed and this will take some time.
Should we just recode the links, or is there an easy way to direct the requests to find the files?
You've got two different options: "Alias" and "ScriptAlias". For the images and such, you add the alias as follows:
Alias /pics /stuff/pics ScriptAlias, as the name implies, is for CGI script directories such as a cgi-bin (ie. for executeable files, not just Javascript ones). It works in the same way. If your needs are more complex, there are the AliasMatch and ScriptAliasMatch directives where you can use regular expressions. All is better explained in the link above. :)
Your other possibility is simply to symlink the directories (assuming you're running a *nix OS), eg.:
ln -s /html/pics /stuff/pics