301 Redirect with htaccess
Sometimes it is necessary to set up a permanent redirect (301). We recommend storing this via a .htaccess file.
Follow these steps:
1. Open editor
Open Notepad or a similar text editor (in Windows: Start – Run – "notepad" – OK)
2. Content
Create a file with the following contents:
Redirect to domain with www
Redirect domain.com to www.domain.com
RewriteEngine On
RewriteBase /
RewriteCond %{HTTP_HOST} !^www.domain.com$ [NC]
RewriteRule ^(.*)$ http://www.domain.com/$1 [L,R=301]
Copy the italicized text into your file and replace domain.com and www.domain.com with the desired domain name.
Redirect to domain without www
Redirect www.domain.com to domain.com
RewriteEngine On
RewriteBase /
RewriteCond %{HTTP_HOST} !^domain.com$ [NC]
RewriteRule ^(.*)$ http://domain.com/$1 [L,R=301]
Copy the italicized text into your file and replace domain.com and www.domain.com with the desired domain name.
3. Save .htacces file
Save the file with File – Save As.... The filename should be .htaccess, the file type should be All Files. Be sure to save the file in ANSI format.
Load now the .htaccess file via FTP into the ROOT-folder of the domain.