1

I have a site with bunch of files, made with using of root relative paths:

<img src="/assets/images/homepage/footer-2.gif"

For testing purposes, i have to place that site in sub folder on my localhost, and on my test server. Of course, because of using of root relative paths, links aren't working.

Is there any way to avoid changing of links, and to make site working properly in sub folder too? (.htacces, maybe)

sinisake
  • 10,637
  • 2
  • 15
  • 27
  • If you know what the path of the page will be you could use relative path URLs for the images rather than root relative path URLs. (e.g., ``) – Coenwulf Mar 27 '15 at 18:49
  • Not sure that i was clear enough... Ideally, i want to keep existing links intact (because files should be re-uploaded to clients host, after changes), but i would like to find way to make site work in subdomain on my localhost and test host. Tried search/replace, and it didn't worked well (i've probably messed up something). Another solution would be some good search/replace routine which will simple remove '/' from the start of links.... – sinisake Mar 27 '15 at 23:40
  • How did you solved this issue? – Muhammad Mabrouk Jan 16 '21 at 18:20
  • @MuhammadMabrouk, hi, as i remember, didn't solved it at all... not sure what i did, at the end, it was a long time ago... – sinisake Jan 17 '21 at 21:14
  • I found the solution in this answer: https://stackoverflow.com/a/35815809/6663458 – Muhammad Mabrouk Jan 19 '21 at 22:33

0 Answers0