It seems that I’ll never get along with mod_rewrite…
I’m in the typical scenario:
homepage_one.tld/impressum.php --> domain.tld?content=impressum
homepage_one.tld/projects.php --> domain.tld?content=projects
homepage_one.tld/projects/canvas.php --> domain.tld?content=projects&project=canvas
I’m developing offline, using Ubuntu Server Edition on an VMware. That means, the local domain for my homepage_one to test is: _http:///localhost:2180/homepage_one/index.php
Later it will be _http://homepage_one.tld.
<Directory /var/www/homepage_one>
RewriteEngine on
RewriteRule ^([^/]*)\.php$ index.php?content=$1 [QSA,L]
RewriteRule ^projects/(.*)\.php$ index.php?content=projects&project=$1 [QSA,L]
</Directory>
All css / image links are *broken * now, when I’m asking for the url: _http://localhost:2180/homepage_one/projects/canvas.php
(It looks for “homepage_one/projects/canvas/style.css” instead of “homepage_one/style.css”
most answers at stackoverflow concerning this issue are: use absolute links. I tried it, but to test it offline, my absolute link would be /homepage_one/style.css and i would have to change ALL links, once I publish the website. I also tried to use the html-base tag. But this didn’t work eigther…. any ideas?
Solution (thanks to @TerryE):
in my case, using port forwarding to different VM’s, I can reach them, as followed:
now I can just use VirtualHosts, as on my production Server, and go with absolute links.