<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>

CC BY-SA 3.0
2016-03-17T22:32:58.983Z
2016-03-17T22:32:58.983Z
Brad Bell
<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>

CC BY-SA 3.0
2016-03-18T10:23:13.940Z
2016-03-18T10:23:13.940Z
Justin K
<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>

<localization><routing>
How to redirect site root to preferred language in multi-language site?
# 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 for setting up a localized site. In the fifth step 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]


---

