1

I have a newly published site, where the localization does not work properly.

https://www.nomadenschaetze.com/de/

When i switch to english, it shows the right englisch homoepage. Now, when i click another englisch site, for example contact, it does not find the templates. https://www.nomadenschaetze.com/en/contact The url is fine, the links have the right domain-urls, but it always goes to the 404.

In my dev- environment though, it is working: the content and navigation changes to english, https://dev.nomadenschaetze.com/de/

i am very confused.

my general.php looks like this:

 // Production environment settings
    'production' => [
        'siteUrl' => array(
            'nomadenschaetze_de' => 'https://www.nomadenschaetze.com/de/',
            'nomadenschaetze_en' => 'https://www.nomadenschaetze.com/en/',
        ),
        'allowAdminChanges' => true,
        'devMode' => false,
        'baseUrl' => 'https://www.nomadenschaetze.com',
        'aliases' => [
            '@root' => getenv('ROOT'),
            '@nomadenschaetze_url' => 'https://www.nomadenschaetze.com',
        ], 
    ],

i have craft 3, in my web folder are a de and en folder. no .htaccess in there in these language folder.

in the web directory i have a .htacces file

<IfModule mod_rewrite.c>
   RewriteEngine On

    # language starts with DE
    RewriteCond %{HTTP:Accept-Language} ^de [NC]
    RewriteRule ^$ /de/ [L,R=301]

    # else redirect to the English version
    RewriteRule ^$ /en/ [L,R=301]

   # Send would-be 404 requests to Craft
   RewriteCond %{REQUEST_FILENAME} !-f
   RewriteCond %{REQUEST_FILENAME} !-d
   RewriteCond %{REQUEST_URI} !^/(favicon\.ico|apple-touch-icon.*\.png)$ [NC]
   RewriteRule (.+) index.php?p=$1 [QSA,L]
</IfModule>

in the root directory i had to add a .htaccess file, because i cannot change the root directory on the server to "web".

RewriteEngine On
RewriteCond %{HTTP_HOST} ^(www\.)?nomadenschaetze\.com [NC]
RewriteCond %{REQUEST_URI} !^/web/.*$
RewriteRule ^(.*)$ /web/$1

what i am doing wrong?

2
  • Do you have any .htaccess? Oct 6 '20 at 6:27
  • i updated my question. a .htaccess file in the web folder, and one in the root directory.
    – Henrik
    Oct 6 '20 at 7:14
1

I finally found the solution!

i was not aware, that the document-root HAS to point to the /web folder. There were old web applications on the server, which prevented to change the root. So i made the .htaccess file, to redirect to the /web folder.

But apparently, this is not going to work. So keep in mind, to point to the right folder.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.