1 users online. Create an account or sign in to join them.Users

Search

Hi!

In the past I’ve used php to redirect visitors based on their browser language. Still new to symphony I don’t know how to use my php scripts with it and looked for another solution.

Here I’ve found a solution using htaccess I just wanted to share.

#The 'Accept-Language' header starts with 'de'
#and the test is case-insensitive ([NC])
RewriteCond %{HTTP:Accept-Language} ^de [NC]
#Redirect user to /de/hauptseite address
#sending 301 (Moved Permanently) HTTP status code
RewriteRule ^$ /de/hauptseite [L,R=301]

RewriteCond %{HTTP:Accept-Language} ^es [NC]
RewriteRule ^$ /es/pagina-primera [L,R=301]

#For every other language (including English :)) use English
RewriteRule ^$ /en/main-page [L,R=301]

Thanks for the snippet!

Create an account or sign in to comment.

Symphony • Open Source XSLT CMS

Server Requirements

  • PHP 5.2 or above
  • PHP's LibXML module, with the XSLT extension enabled (--with-xsl)
  • MySQL 5.0 or above
  • An Apache or Litespeed webserver
  • Apache's mod_rewrite module or equivalent

Compatible Hosts

Sign in

Login details