View Full Version : Redirect a call for /css/file.css to /dir/css/file.css ?

05-12-2010, 12:42 PM
I just setup an apache server last night, and I'm liking what I see. I have all of my files contained in /htdocs/ but I have a few websites that I have on my new local server that I've copied from my live server. Inside the /htdocs/ directory, I have three folders, like this example directory structure:



Now, in each of the website folders, paths to included files (such as CSS and Javascript) are written as though the each website is on its own domain. So, for example, each one would call a CSS file in the HTML with this path:

However, now that these three websites and their files are under a main root directory, calls such as these are looking for a /css/ directory in the /htdocs/ folder instead of in the specific website/ folder (whether it be website1, 2, or 3).

What I would like to know is if there is any way to make it so that these calls with leading slashes / will look for the files and directories that are called in the root of the website folder they are inside of, instead of looking for them in the actual /htdocs/ root directory.

Thanks a lot!

05-12-2010, 03:34 PM
You could make virtual hosts under your xampp, say local1.com, local2.com etc, and then point them to their respective directories.

05-12-2010, 10:07 PM
I never even knew that was possible. Thanks for that! A few changes to httpd-vhosts.config and the Windows Hosts file and now I have it working just the way I wish. :)

By the way, if anyone else has the same question, check out this link: http://www.cortello.com/forum/viewtopic.php?f=9&t=31. It worked for me, and hopefully should work for others, too.