-3

I have created an .htaccess file with the following code in order to achieve this

Options +FollowSymLinks
RewriteEngine on
RewriteCond %{HTTP_HOST} ^example.lk[nc]
RewriteRule ^(.*)$ http://www.example.lk/$1 [r=301,nc]

but following http://example.lk doesn't redirect to www.example.lk it failed and

[example.lk is only for example]

guest
  • 1
  • 1

1 Answers1

3

[nc] has to be the third argument to RewriteCond, and therefore it needs to be preceded by at least one space.

200_success
  • 4,701
  • 1
  • 24
  • 42