I am building a new website which has URLs such as:
Then I have URL rewriting running on the server, which translates a URL such as:
...into the above one (with the .htm at the end).
I also have a CSS reference like this:
<link rel="stylesheet" href="css/main.css">
But that did not work with the URL rewriter, because the browser thinks it is in a subdirectory and therefore does not find the CSS file, so I changed it to:
<link rel="stylesheet" href="/css/main.css">
That seems to work. So far, so good.
However, I am doing most of my development locally on a Mac using MAMP and CodeKit. So my local test URL looks like this:
Using that, my "/css/main.css" reference does not work, because it is looking here:
...rather than here:
So one method works locally, the other works on the server, but neither works on both.
One solution might be to upgrade to MAMP PRO, which I believe would allow me to create full virtual websites locally, thereby getting rid of the longer local URL structure (no sub-directory for domain.com). I have to verify this with MAMP PRO.
I'm wondering if there is any other solution I am not thinking of. Any advice?