Forum Moderators: phranque
#add WWW and redirect
RewriteCond %{HTTP_HOST} !^www.mywebsite.nl$ [NC]
RewriteRule ^(.*)$ http://www.mywebsite.nl/$1 [L,R=301]
#add trailing slash & prevent duplicate content
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_URI} !(.*)/$
RewriteRule ^(.*)$ http://www.mywebsite.nl/$1/ [L,R=301]
# Externally redirect to add missing trailing slash if requested URL-path does not resolve to an existing file
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.*[^/])$ http://www.mywebsite.nl/$1/ [L,R=301]
#
# Externally redirect all non-blank non-canonical hostname requests to canonical hostname
RewriteCond %{HTTP_HOST} !^(www\.mywebsite\.nl)?$
RewriteRule ^(.*)$ http://www.mywebsite.nl/$1 [L,R=301]