I implemented some mod_rewrite magic to turn nasty id-filled urls into user-friendly ones with clear text names. Unfortunately, the paths for these new urls have no relation at all to the original path so all of my images, links, css, and javascript are all broken.
For example, the old url:
http://mydomain.com/dir/pg1.php?id=1234
new url:
http://mydomain.com/products/electronics/stereos/sony-walkman
Although the url is totally different, the HTML produced is identical. This causes a problem because all of my image, css, script, and links are RELATIVE references and I don't have any directory structures corresponding to /products/electronics/stereos.
There is no way at all to create all the necessary directory structures and put images in them because the directories differ for every product category and have no relation at all to my actual file structure.
Another possibility is changing relative file references to absolute ones (.e.g., instead of <img src="images/foo.jpg"> I could use <img src="/catalog/products/images/foo.jpg">. This will require A LOT of changes to my files and then I'll have to change everything all over again when I move the files from my test directory to the production directory.
Has anyone else dealt with this problem? I'd really like to know the easiest way to deal with it. Hopefully someone has a clever, elegant solution.