htaccess to change URLs on the fly?
Hello everyone.
I'm trying to do something with .htaccess files, and I thought that someone here might have an idea about this.
I have a website, currently located in the server root, which links to it's images and pages using direct URLs like /images/logo.png and /section/page.html . However, I want to move that site to a subdirectory, yet keep the links in working order without having to change them. What I would need is some sort of .htaccess file located in the site's new subdirectory that would modify the links of the page to keep them all relative to the subdirectory instead of the root. For example, links like /images/logo.png should be automatically converted by Apache to something like /old/images/logo.png (notice the added /old/ part). It's probably possible, I just don't know how (the doc on mod_rewrite is pretty dense). I don't know either if I'm clear in my explanations, so feel free to ask if you don't understand.
Can anyone help?
Re: htaccess to change URLs on the fly?
Can you set up a pointer to the images (like a url redirection), then for each image it goes to that redirection first, then the slashes??
Just a thought, not sure if its viable.
Re: htaccess to change URLs on the fly?
That wouldn't work for a reason: I have a new set of pictures that took over the the old one. Therefore, I can't put a redirection instead of that picture... Right now, the old site links to the new pictures, while I want it to still link to the old set. That's why I'm looking for another solution.