Thread: URL redirection

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

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

    Quote Originally Posted by RodG View Post
    What are you seeing in the browser URL for any given request?
    It seems like the rewrites are are not working because I don't see the "&language=de" and "&language=en" at the end of each URL (unless I manually select a language). Also there is no styling as if the css file for some reason is not read. Very strange

    What I have in htaccess is:

    Code:
    RewriteEngine On
    
    RewriteCond %{HTTP_HOST} ^www\.example\.de [NC] 
    RewriteRule ^(.*)$ index.php?language=de [NC,QSA] 
    
    RewriteCond %{HTTP_HOST} ^www\.example\.co\.uk [NC] 
    RewriteRule ^(.*)$ index.php?language=en [NC,QSA]
    Typical URL's without a language is selected are:
    Code:
    http://www.example.co.uk/index.php?main_page=index&cPath=65
    http://www.example.co.uk/index.php?main_page=product_info&cPath=65&products_id=180
    http://www.example.co.uk/index.php?main_page=contact_us
    and when a language is selected then they are:
    Code:
    http://www.example.co.uk/index.php?main_page=index&cPath=65&language=en
    http://www.example.co.uk/index.php?main_page=product_info&cPath=65&products_id=180&language=en
    http://www.example.co.uk/index.php?main_page=contact_us&language=en
    What could be wrong with the htaccess statements?

    Unfortunately I currently can't give you the URL for the site because it's down for maintenance to avoid search engines to index the pages yet as that would result in duplicate content because most of the contest on the two domains is still only in English as I haven't translated the .de domain to German yet.

  2. #12
    Join Date
    Jun 2007
    Posts
    70
    Plugin Contributions
    1

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

    It depends what you want.

    If you want to set the language in cookies by visiting one of those domains then you need:

    Code:
    RewriteBase /
    RewriteCond %{HTTP_HOST} ^(www\.|)example\.co\.uk$ [NC] 
    RewriteRule ^$ index.php?language=en [L] 
    RewriteCond %{HTTP_HOST} ^(www\.|)example\.de$ [NC] 
    RewriteRule ^$ index.php?language=de [L]
    If you want to redirect, then:

    Code:
    RewriteBase /
    RewriteCond %{HTTP_HOST} ^(www\.|)example\.co\.uk$ [NC] 
    RewriteRule ^$ index.php?language=en [R=301,L] 
    RewriteCond %{HTTP_HOST} ^(www\.|)example\.de$ [NC] 
    RewriteRule ^$ index.php?language=de [R=301,L]

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

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

    Thanks a lot iRAY, now its almost working! Im using what you mentioned to redirect :

    Code:
    RewriteBase /
    RewriteCond %{HTTP_HOST} ^(www\.|)example\.co\.uk$ [NC] 
    RewriteRule ^$ index.php?language=en [R=301,L] 
    RewriteCond %{HTTP_HOST} ^(www\.|)example\.de$ [NC] 
    RewriteRule ^$ index.php?language=de [R=301,L]
    This gives me "http://www.example.co.uk/index.php?language=en" when I go to "www.example.co.uk" and "http://www.example.de/index.php?language=de" when I go to "www.example.de", exactly as I want. However, as soon as I click a link on the index page the "language=de" or "language=en" disappears.
    So one question remains: How do I apply this rule to all pages? not only the index page.

  4. #14
    Join Date
    Jan 2004
    Posts
    66,446
    Plugin Contributions
    81

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

    Quote Originally Posted by DML73 View Post
    However, as soon as I click a link on the index page the "language=de" or "language=en" disappears.
    That's by design.
    Zen Cart automatically removes the language=XX parameter from the URL on next click, because it's already been set into the customer's browsing session (associated with the session cookie which Zen Cart sets when the page is displayed).
    Quote Originally Posted by DML73 View Post
    So one question remains: How do I apply this rule to all pages? not only the index page.
    You don't.


    MODERATOR NOTE: Your 2 duplicate threads have been merged. Not sure why you started a second one to re-discuss the same issue again.
    .

    Zen Cart - putting the dream of business ownership within reach of anyone!
    Donate to: DrByte directly or to the Zen Cart team as a whole

    Remember: Any code suggestions you see here are merely suggestions. You assume full responsibility for your use of any such suggestions, including any impact ANY alterations you make to your site may have on your PCI compliance.
    Furthermore, any advice you see here about PCI matters is merely an opinion, and should not be relied upon as "official". Official PCI information should be obtained from the PCI Security Council directly or from one of their authorized Assessors.

  5. #15
    Join Date
    Oct 2007
    Posts
    412
    Plugin Contributions
    0

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

    Thanks for the information Dr.Byte and everybody else. It seems like this is finally working. Here is a summary of how I accomplished this:

    1. Point both domain names to the same server (via domain name registrar).

    2. One domain name must be the main domain on the server, the other must be “parked” (via web hosting company).

    3. Use below statements in root htaccess:

    RewriteBase /
    RewriteCond %{HTTP_HOST} ^(www\.|)example\.co\.uk$ [NC]
    RewriteRule ^$ index.php?language=en [R=301,L]
    RewriteCond %{HTTP_HOST} ^(www\.|)example\.de$ [NC]
    RewriteRule ^$ index.php?language=de [R=301,L]

    4. To prevent a visitor is automatically directed to the main domain when he clicks a link on the parked domain change:

    define('HTTP_SERVER', 'http://www.example.de');
    define('HTTPS_SERVER', 'https://www.example.de');

    in includes/configuration.php to:

    define('HTTP_SERVER', '');
    define('HTTPS_SERVER', '');

    So I guess what is missing is to avoid search engines double-indexing where same language is selected on both domains, as for example:

    http://www.example.co.uk/index.php?m...index&cPath=65 (English language selected)
    http://www.example.de/index.php?main...index&cPath=65 (English language selected)

    I guess I will need to disable the language selecting bar so visitors (and search engines) won't have the possibility to select above example; and instead just put a link to each language domain www.example.co.uk and www.example.de

    Im not sure if this is the correct way to do all this but apparently it seems to be working so far.

  6. #16
    Join Date
    Jan 2004
    Posts
    66,446
    Plugin Contributions
    81

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

    Keep in mind that Zen Cart has a setting that lets you have it auto-negotiate the customer's selected language based on the customer's own preferences they've set in their browser ... therefore giving them the optimal experience regardless of the URL they visited.
    .

    Zen Cart - putting the dream of business ownership within reach of anyone!
    Donate to: DrByte directly or to the Zen Cart team as a whole

    Remember: Any code suggestions you see here are merely suggestions. You assume full responsibility for your use of any such suggestions, including any impact ANY alterations you make to your site may have on your PCI compliance.
    Furthermore, any advice you see here about PCI matters is merely an opinion, and should not be relied upon as "official". Official PCI information should be obtained from the PCI Security Council directly or from one of their authorized Assessors.

 

 
Page 2 of 2 FirstFirst 12

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