<p>Make sure to remove Craft’s default rewrite rule (“Send would-be 404 requests to Craft”) from the .htaccess in your document root, so it’s only in the .htaccess files of your locales’ subfolders. You can now remove the index.php as well and requests to your homepage domain.com/ should now respond with a 404 HTTP error.</p>

<p>You have now removed all (duplicate) routes starting at root level.</p>

<p>Last step is to redirect visits to the homepage to en/ via the .htaccess in your document root.</p>

<pre><code>RewriteEngine On
RewriteRule ^$ /en [R=301,L]
</code></pre>

CC BY-SA 3.0
2017-11-14T20:42:51.643Z
Perfect, thank you.
CreateSean
CC BY-SA 3.0
2017-11-14T16:37:00.553Z
2017-11-14T16:42:04.540Z
2017-11-14T16:42:04.540Z
carlcs
<p>I'm setting up a multi-lingual site and want to force the language segments:</p>

<p>domain.com/en/<br>
domain.com/fr/</p>

<p>However if you go in the URL bar and remove the en/ or fr/ it loads up the English page without the language segment. How do I force this to load. Have tried a few .htaccess suggestions found via Google but nothing is working.</p>

CC BY-SA 3.0
2017-11-14T13:32:22.977Z
Just wondering if you ever got a solution for this one? If so I'd be interested to hear what it is. Thanks! Andrew
Andrew Macpherson
CC BY-SA 3.0
2017-11-14T13:51:09.160Z
Not yet, and not sure what to do.
CreateSean
<localization><htaccess>
Force language segment in URL on multi-lingual site
# Force language segment in URL on multi-lingual site

(Asked by: username_0 on 2017-11-09)

I'm setting up a multi-lingual site and want to force the language segments:

domain.com/en/  
domain.com/fr/

However if you go in the URL bar and remove the en/ or fr/ it loads up the English page without the language segment. How do I force this to load. Have tried a few .htaccess suggestions found via Google but nothing is working.

**Tags:** localization, htaccess
> **Comments:**
> **username_1**: Just wondering if you ever got a solution for this one? If so I'd be interested to hear what it is. Thanks! Andrew  
> **username_0**: Not yet, and not sure what to do.  

---

## 1 answers

### Answer by username_2 on 2017-11-14. Score: 2

Make sure to remove Craft’s default rewrite rule (“Send would-be 404 requests to Craft”) from the .htaccess in your document root, so it’s only in the .htaccess files of your locales’ subfolders. You can now remove the index.php as well and requests to your homepage domain.com/ should now respond with a 404 HTTP error.
You have now removed all (duplicate) routes starting at root level.
Last step is to redirect visits to the homepage to en/ via the .htaccess in your document root.
RewriteEngine On
RewriteRule ^$ /en [R=301,L]

> **Comments:**
> **username_0**: Perfect, thank you.  

---

