Question

We have a web proyect in Coldfusion. All resources are linked with absolute paths, I mean, the paths in the css are like this:

.class {background:url(/folder/img/image.png);}

And the paths in the HTML are like this:

<img src="/folder/img/theimage.png"/>

I need to download the files to my local machine, make the changes and upload them again. To see the changes, I manually remove all the slashes in the downloaded files, then write it again, but I think that should be an easier way to see the pages correctly without make those changes.

Can I put the resources folder in some place to make the absolute path find them?
If that's not the correct way, how can I "see" the files in my local machine (without a localhost) without changing the absolute path once and once again?

Was it helpful?

Solution

Do your local development on a computer with a web server that is configured to be as close to the web server you use in production as possible.

Using a virtual machine (such as VMWare or VirtualBox) makes this easier.

OTHER TIPS

Most modern dev. platforms have HTTP servers that are easy to set up. My favorite has always been Python's. Running it is as simple as cding to your project directory and running one Python command. You can also easily run multiple servers concurrently on different ports.

Here are some examples with Python v. 2.7.

# run server on port 9999
> python -m SimpleHTTPServer 9999

# run server as background process on port 3333
> nohup python -m SimpleHTTPServer 3333 > /dev/null &

Python 3 has a different syntax, but same idea. See https://developer.mozilla.org/en-US/docs/Learn/Common_questions/set_up_a_local_testing_server

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top