redirect

Redirect using RedirectMatch to language prefix

This is how you can redirect a former indexed path without languagre prefix to a new path with language prefix. In this case i had my old path look like "[domain]/konwledge/[title]" and the new site had a language prefix so the new path should look like "[domain]/en/konwledge/[title]". Add the following in the .htaccess files within the IfModule mod_rewrite.c-tag and modify it.

RedirectMatch 301 ^/knowledge/(.+)$ http://www.zimplicit.se/en/knowledge/$1

Redirect your site to always use www

For make it easy measuring traffic or with sessions cookies for login, you can redirect all calls for example.com to www.example.com by adding the following script to a .htaccess file in root of your site.

<IfModule mod_rewrite.c>
  RewriteEngine on
  RewriteCond %{HTTP_HOST} ^example\.com$ [NC]
  RewriteRule ^(.*)$ http://www.example.com/$1 [L,R=301]
</IfModule>

Probably you already have an .htaccess file and you just have to uncomment the code and change example.com to your domainname.