tags:

views:

11

answers:

1

Hi everyone, I'm trying to redirect all requests for example.domain.com to www.domain.com

Options +FollowSymLinks
RewriteEngine on
RewriteRule (.*) http://www.domain.com/$1 [R=301,L]

Seems to cause a 500 internal server error as does

Options +FollowSymlinks
RewriteEngine on
rewritecond %{http_host} ^domain.com [nc]
rewriterule ^(.*)$ http://www.domain.com/$1 [r=301,nc] 

So my question is why are these failing and how do I fix it?

A: 

After your first two lines, add:

RewriteCond %{http_host} ^.domain.com
RewriteRule ^(.*) http://domain.com/$1 [R=301]
Evan Mulawski
This still causes an internal server error, did I understand you correctly? Options +FollowSymlinksRewriteEngine onRewriteCond %{http_host} ^.domain.comRewriteRule ^(.*) http://domain.com/$1 [R=301]RewriteRule (.*) http://www.domain.com/$1 [R=301,L]
toomanyairmiles
Keep the Options and RewriteEngine lines the way they are, then add the two lines that I provided, removing everything else.
Evan Mulawski