Any htaccess experts around?


I have set up a nice rule for a coming dual-language site. If the browser is set to any german language, it will display the german version. All others will see the english version.

Now I would like to do the same for a 404 page as I am using @joeworkman excellent SEO helper.

How would I do this? The htaccess is placed this way in the root, the site in a de and en folder:

This is the actual code:

#The 'Accept-Language' header starts with 'de'
#and the test is case-insensitive ([NC])
RewriteCond %{HTTP:Accept-Language} ^de [NC]

#Redirect user to /de/index.php address

#sending 301 (Moved Permanently) HTTP status code

RewriteRule ^$ /de/index.php [L,R=301]

#For every other language (including English :)) use English

RewriteRule ^$ /en/index.php [L,R=301]

Could I add any instructions to this code or something completely different?

Thank you,

Watch the live streams that I did on how to do a multi-language site using the Agent Lang stacks. They are pretty awesome.

I recommend watching both in order.

Do you have additional htaccess files in each of the sub-directories?

I don’t see an error document statement in the sample htaccess file?

ErrorDocument 404  /404.html

You should be able to have separate 404 pages in each of the sub-directories, de, and en. Then have two additional htaccess files (one in each directory.

So when my request hits the main site the primary htaccess will redirect me to the appropriate directory.
It then should then apply the rules in the htaccess in the sub-directory.