I tried to create a development server by copying a website from one host to a second different host, but the servers seem to handle virtual paths differently.
On the main server this works:
<link href="/styles/styles.css" rel="stylesheet" type="text/css">
On the dev server the same path would need to be written as (without the first slash):
<link href="styles/styles.css" rel="stylesheet" type="text/css">
How can I make the dev server work with the main servers files without rewritting the paths? Is this something I can do from .htaccess with mod rewrite?
First, some background on how paths work. Absolute paths are based on the server root. Relative paths are based on the URL (not the file path) of the current page. However, this behavior is NOT handled by the server--its handled by the client, and this behavior is universal (Yes, even IE6... I know, surprise!). The only thing that would cause these two paths to NOT be the same would be if they're not relative to the root of the web site.
For example, if we're trying to access the URL you mentioned above (/styles/styles.css), here's how they would behave on the following two examples:
"Main Server" web site hosted at http://mainwebsite/index.html
"Dev Server" web site hosted at http://devsite/some_sub_dir/index.html
If you clarify your answer (these servers are clearly not hosting the same data in the same way), I could provide a more accurate description. However, if I had to guess, I'd say you're probably running into the issue I described.
Good luck!
Andrew