views:

82

answers:

1

I need to redirect all example.com to www.example.com except for example.com/subdirectory which should remain as is without any redirection.

A: 

I have solved the problem by having the following in the .htaccess file

RewriteEngine On

RewriteCond $1 !^subdirectory RewriteCond %{HTTP_HOST} !^www.example.com$ [NC] RewriteRule ^(.*)$ http://www.example.com/$1 [L,R=301]