Forum Moderators: phranque

Message Too Old, No Replies

URL Path Problem

         

noah_body

11:43 pm on Nov 26, 2003 (gmt 0)

10+ Year Member



Here's my problem...

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.

jdMorgan

1:07 am on Nov 27, 2003 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



First, don't advertise root.com/fr anymore, don't link to it anymore, and don't think of it as a URL, but rather consider /fr only as a subdirectory in the server file system. From now on, just ignore that URL path (It doesn't matter that it exists, but take a 'pure domain view' and work forward from there to avoid muddled thinking.)

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