Forum Moderators: phranque
I have a website in English. Let's call that root.com. I was asked to build, on the same site, a foreign version. That site was built in the root.com/fr directory, with all links (images and links) being relative to the root (so an image file would be /image/ no matter which directory it's in.
Now, I've just been told that the foreign site should be accessable by either going root.com/fr, or root.fr/ . That would mean that any link using the root.fr url is broken (root.fr/image/ would really be root.com/fr/image/ which doesn't exist. All images are off of root.com, and root.fr will links to both pages in the root.com/fr directory, as well as other files (including the cgi bin) off or root.com/
Any suggestions how to handle this? I have a few rough ideas, but right now they're just guesses.
Thanks.
Once you've got root.fr pointed to your server, you are left with the simple case of checking %{REMOTE_HOST} and redirecting to /fr if hostname root.fr is requested. You can then inhibit redirection for common files such as images that are no different for the two domains.
If you foresee adding even more languages in the future, you might even consider moving all of your english content to subdirectory /en to simplify maintenance and make your domain-related subdirectory redirects consistent.
For testing purposes, I'd suggest creating a /test subdirectory, and redirect root.fr requests there while leaving the old root.com/fr access method (and files) untouched. Once you get everything working, then you can switch over.
When working with domain subdirectories like this, use relative links when possible, and where absolutely required, use canonical links which *do not* contain the subdirectory name -- remember that the rewrite will always take care of adding that in.
Jim