Answers.Body: <p>I would put a <code>.htaccess</code> file in the public HTML folder and let Apache deal with it, that way you don't have the overhead of PHP/Craft having to deal with that request.</p>
  
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2016-03-17T22:32:58.983Z
Answers.LastActivityDate: 2016-03-17T22:32:58.983Z
Answers.UserDisplayName: Brad Bell
Answers.Body: <p>Here's the setup I used for the .htaccess file if anyone is interested:</p>
  
  <pre><code>RewriteEngine on
  RewriteCond %{REQUEST_URI} ^/$
  RewriteRule (.*) http://example.com/new_directory/ [R=301,L]
  </code></pre>
  
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2016-03-18T10:23:13.940Z
Answers.LastActivityDate: 2016-03-18T10:23:13.940Z
Answers.UserDisplayName: Justin K
Body: <p>I followed the Craft <a href="https://craftcms.com/docs/localization-guide" rel="nofollow">directions</a> for setting up a localized site. In the <a href="https://craftcms.com/docs/localization-guide#step-5-set-up-the-files" rel="nofollow">fifth step</a> I followed the first example for setting up my folder structure. In my case the languages I'm working with are French and Arabic.</p>
  
  <pre><code>craft/
  public_html/
     fr/                 --&gt; example.com/fr/ (french)
        .htaccess
        index.php
     ar/                 --&gt; example.com/ar/ (arabic)
        .htaccess
        index.php
  </code></pre>
  
  <p>The primary language for the site is French, what is the best way to redirect so that if a visitor comes to the root of the site <code>www.example.com</code> they will be redirected to the French version at <code>www.example.com/fr/</code> ?</p>
  
  <p>Should I use a .htaccess file in main public_html directory of the site, should I use the dynamic routes in Craft, or is there some other, better, way?</p>
  
Tags: <localization><routing>
Title: How to redirect site root to preferred language in multi-language site?
ThreadText: # How to redirect site root to preferred language in multi-language site?
  
  (Asked by: username_0 on 2016-03-17)
  
  I followed the Craft [directions](https://craftcms.com/docs/localization-guide) for setting up a localized site. In the [fifth step](https://craftcms.com/docs/localization-guide#step-5-set-up-the-files) I followed the first example for setting up my folder structure. In my case the languages I'm working with are French and Arabic.
  
  ```
  craft/
  public_html/
     fr/                 --> example.com/fr/ (french)
        .htaccess
        index.php
     ar/                 --> example.com/ar/ (arabic)
        .htaccess
        index.php
  
  ```
  
  The primary language for the site is French, what is the best way to redirect so that if a visitor comes to the root of the site `www.example.com` they will be redirected to the French version at `www.example.com/fr/` ?
  
  Should I use a .htaccess file in main public\_html directory of the site, should I use the dynamic routes in Craft, or is there some other, better, way?
  
  **Tags:** localization, routing
  
  
  ---
  
  ## 2 answers
  
  ### Answer by username_1 on 2016-03-17. Score: 3 | Accepted answer
  
  I would put a `.htaccess` file in the public HTML folder and let Apache deal with it, that way you don't have the overhead of PHP/Craft having to deal with that request.
  
  
  ---
  
  ### Answer by username_0 on 2016-03-18. Score: 2
  
  Here's the setup I used for the .htaccess file if anyone is interested:
  
  ```
  RewriteEngine on
  RewriteCond %{REQUEST_URI} ^/$
  RewriteRule (.*) http://example.com/new_directory/ [R=301,L]
  
  ```
  
  
  ---
  
  