Thread: URL redirection

Page 1 of 2 12 LastLast
Results 1 to 10 of 16
  1. #1
    Join Date
    Oct 2007
    Posts
    412
    Plugin Contributions
    0

    Default URL redirection

    Lets say I have a domain called www.e x a m p l e.de in German and one called www.e x a m p l e.co.uk in English. I have English (default) and German language packages installed in my Zencart.
    When users go to www.e x a m p l e.de I want them to land on the German version and if they go to www.e x a m p l e.co.uk I want them to land on the English version.
    I assume that I will need some kind of URL redirection in my host's cPanel, but how is this exactly done? How can I redirect www.e x a m p l e.de to the German version of Zencart and www.e x a m p l e.co.uk to the English version??

  2. #2
    Join Date
    Jul 2012
    Posts
    16,816
    Plugin Contributions
    17

    Default Re: URL redirection

    Quote Originally Posted by DML73 View Post
    Lets say I have a domain called www.e x a m p l e.de in German and one called www.e x a m p l e.co.uk in English. I have English (default) and German language packages installed in my Zencart.
    When users go to www.e x a m p l e.de I want them to land on the German version and if they go to www.e x a m p l e.co.uk I want them to land on the English version.
    I assume that I will need some kind of URL redirection in my host's cPanel, but how is this exactly done? How can I redirect www.e x a m p l e.de to the German version of Zencart and www.e x a m p l e.co.uk to the English version??
    So, pleaase forgive me that I don't have significant experience with redirection from a url alone, but basically I would think that you would use your htaccess, such that if the host was, x: and the "language" option was not present then to set the language redirect to the applicable language. If it was set leave it alone...

    This would be accomplished using the url rewrite options/settings. But that is my late night Friday ideas. :)
    ZC Installation/Maintenance Support <- Site
    Contribution for contributions welcome...

  3. #3
    Join Date
    Oct 2007
    Posts
    412
    Plugin Contributions
    0

    Default Re: URL redirection

    Thanks for the suggestion. I now found out that I first have to point both domain names to the same server, and then setup the right code in htaccess. Does anybody have an example of the code I would need to enter in htaccess?

  4. #4
    Join Date
    Jul 2012
    Posts
    16,816
    Plugin Contributions
    17

    Default Re: URL redirection

    Quote Originally Posted by DML73 View Post
    Thanks for the suggestion. I now found out that I first have to point both domain names to the same server, and then setup the right code in htaccess. Does anybody have an example of the code I would need to enter in htaccess?
    Hmm, so I'm personally trying to figure out how this would be done as well... Are uplanning on having a single set of files to reference, but just the correct language show up? If done this way, seems you will have to pick a domain name to use as the base server name, otherwise you could have two directories for your store, both pointing to the same database, that way the uri would remain as whatever one they entered. Maybe use a plugin that "manages" multiple sites. Reason for the multiple site perspective though would be that the mailing address of the german sitemay need to be different than the mailing address to the other site as entered in the my store area of the store.

    So, thinking that you would want to describe here how you want to have your site setup/look to be able toget the answers you seek.
    ZC Installation/Maintenance Support <- Site
    Contribution for contributions welcome...

  5. #5
    Join Date
    Jan 2007
    Location
    Australia
    Posts
    6,167
    Plugin Contributions
    7

    Default Re: URL redirection

    Quote Originally Posted by DML73 View Post
    Thanks for the suggestion. I now found out that I first have to point both domain names to the same server, and then setup the right code in htaccess. Does anybody have an example of the code I would need to enter in htaccess?
    Try this:
    http://www.htaccesstools.com/redirection-by-language/

    Cheers
    RodG

  6. #6
    Join Date
    Mar 2014
    Location
    Indonesia
    Posts
    1
    Plugin Contributions
    0

    Default Re: URL redirection

    Quote Originally Posted by RodG View Post
    I will try it on my site, and again asked if an error occurs. Thank you

  7. #7
    Join Date
    Oct 2007
    Posts
    412
    Plugin Contributions
    0

    Default Question for htaccess experts regarding two domains and language packs

    I have two domain names pointing to the same server:
    www.example.co.uk (English language)
    and
    www.example.de (German language)

    The content is the same except that www.example.co.uk is in English and www.example.de is in German.

    How can I by using htaccess force a visitor that goes to:
    http://www.example.co.uk
    to land on:
    http://www.example.co.uk/index.php?m...ex&language=en
    and stay within the English language pack regardless of which page he navigates to (except if he manually change the language at the language selection bar).

    And the same for www.example.de:
    force a visitor that goes to:
    http://www.example.de
    to land on:
    http://www.example.co.uk/index.php?m...ex&language=de

    I have been trying to use this:
    RewriteCond %{HTTP_HOST} ^www\.www.example\.co.uk [NC]
    RewriteRule ^(.*)$ index.php?language=en [NC,QSA]
    RewriteCond %{HTTP_HOST} ^www\.www.example\.de [NC]
    RewriteRule ^(.*)$ index.php?language=de [NC,QSA]

    but this appears to do nothing.
    Any help is much appreciated.

  8. #8
    Join Date
    Jan 2007
    Location
    Australia
    Posts
    6,167
    Plugin Contributions
    7

    Default Re: Question for htaccess experts regarding two domains and language packs

    Quote Originally Posted by DML73 View Post
    I have been trying to use this:
    RewriteCond %{HTTP_HOST} ^www\.www.example\.co.uk [NC]
    RewriteRule ^(.*)$ index.php?language=en [NC,QSA]
    RewriteCond %{HTTP_HOST} ^www\.www.example\.de [NC]
    RewriteRule ^(.*)$ index.php?language=de [NC,QSA]

    but this appears to do nothing.
    Any help is much appreciated.
    I think you're on the right track, BUT......

    ^www\.www\.example.......................

    This will almost certainly never find a match. Re-write these as
    ^www\.example............ (only one 'www')

    Also, in the 1st RewriteCond you are missing the escape character "\" before the "." in "uk".
    Should be
    RewriteCond %{HTTP_HOST} ^www\.example\.co\.uk [NC]

    In addition to this, it would be prudent to check for the same conditions *without* the 'www'.

    Cheers
    RodG

  9. #9
    Join Date
    Oct 2007
    Posts
    412
    Plugin Contributions
    0

    Default Re: Question for htaccess experts regarding two domains and language packs

    Thanks for the comment RodG, it now seems to be partly working, when I land on the index pages; www.example.co.uk is in English and www.example.co.uk is in German however as soon as I click on a link on the English site it changes to www.example.de and the German language.
    When I go to www.example.de it does stay on the German language however, even when I click a link.
    It also appears as the css file and image directory are not being read because the sites are displayed without images and css styling.

    I suspect at least there is something wrong with the rewrite rule:

    RewriteRule ^(.*)$ index.php?language=de [NC,QSA]

    Should the "index.php?language=de" be changed to something different?

  10. #10
    Join Date
    Jan 2007
    Location
    Australia
    Posts
    6,167
    Plugin Contributions
    7

    Default Re: Question for htaccess experts regarding two domains and language packs

    Quote Originally Posted by DML73 View Post
    Should the "index.php?language=de" be changed to something different?
    Sorry, but I honestly couldn't say. I'm really not all that familiar with how ZenCart handles different languages. In fact if it wasn't for your example I would never have thought about rewriting the URL's to select a different language.

    My previous input was based purely on the things that I could see were wrong, which isn't quite the same thing as telling you the things that could be right.

    Offhand, I can't see what would be wrong with this current rewriteRule. It *looks* like it should be right.

    What are you seeing in the browser URL for any given request?

    What you *should* be seeing (if the rewrites are working correctly) is something like
    Again, I've no idea whether these will give you the *results* you desire because that would depend on how the URI is parsed by ZenCart, but it will confirm whether the rewrites are being performed or not.

    Cheers
    RodG

    ps. Could you give us/me the URL for the site(s). Offhand I don't know of any site that is using multiple languages (Although I'm sure there are lots of them around), and it would be useful to see this in action.
    Last edited by RodG; 29 Mar 2014 at 03:41 PM.

 

 
Page 1 of 2 12 LastLast

Similar Threads

  1. Page redirection
    By chandroo007 in forum General Questions
    Replies: 3
    Last Post: 29 Oct 2010, 06:57 AM
  2. admin redirection
    By icehokz in forum Templates, Stylesheets, Page Layout
    Replies: 2
    Last Post: 19 Mar 2009, 07:22 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
disjunctive-egg