views:

40

answers:

1

I'm having a really strange issue with .htaccess - I'm trying to rewrite the domain so it always prepends www to the domain when loaded - this works for about five minutes and then just turns the page blank!?

.htaccess:

RewriteEngine On

RewriteBase /
RewriteCond %{HTTP_HOST} !^www.thedomain.co.uk$ [NC]
cRewriteRule ^(.*)$ http://www.thedomain.co.uk/$1 [L,R=301]

Any ideas?

+2  A: 

Firstly, make sure to remove leading "c" in the last line.

Secondly, you should probably escape dots as shown below.

RewriteEngine On
RewriteCond   %{HTTP_HOST}   !^www\.thedomain\.co\.uk$     [NC]
RewriteRule   ^(.*)$         http://www.thedomain.co.uk/$1 [R=301,L]
David Kuridža
Thanks, the c was an accident from copy + pasting, that's not in the code. It seems whenever I have a htaccess file it behaves as expected for about 5 mins then the site just goes completely blank!
kron
Have you checked the logs? Try putting above rules into vhost itself.
David Kuridža