Hello,

I'm trying to find a way of including a htaccess rewrite to redirect anyone visiting http://site.com to http://www.site.com.

I've tried the following...

RewriteEngine On
RewriteCond %{HTTP_HOST} ^(www.)?site.co.uk [NC]
RewriteRule ^(.*)$ http://www.site.co.uk/$1 [R=301,L]

...but it broke the paths to all of my assets - adding a "www" where there shouldn't be one.

How can I get around this issue?

Chris

Bizzarely, it seems the web hosts have fixed the issue.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.