Forum Moderators: phranque
Like most web developers, I develop and test sites locally, then upload them to public servers when they're ready. Sites that I build from scratch use relative paths, so moving them around is easy. It's when I have to work with _other_ people's code that things can get ugly.
For example, a site I'm working on today is full of hyperlinks that start with "/". I access the site on my local machine by going to:
[localhost...]
The problem is that links on index.php that start with "/" resolve to:
[localhost...]
This is true even when using HTML base tags. :-(
One solution I know would work would be for me to trudge through the dozens upon dozens of PHP scripts that make up the site, identifying every link (many are dynamically generated - and don't forget about linked style sheets and JavaScripts, images, etc.) and make them all relative, like they should've been in the first place!
What I'd like to do is to somehow tell Apache that [localhost...] is that site's root. (Or can I map a DynDNS hostname to a specific subdirectory on my machine?)
I'm looking at my configuration, and I can't imagine that I'm the only person to have ever encountered this problem.
Any insight would be GREATLY appreciated. This is an issue I've been trying to tackle for a long time.
RewriteCond %{REQUEST_URI} !^/sitename
RewriteRule ^/(.*) /sitename/$1 [PT]
but do you have multiple "sitename" folders under the docroot? Then this hack will only work with one sitename at a time, but that should serve the purpose if working with this site and being done with it. Just comment it out when you're finished.
.