Forum Moderators: phranque
I have a http://www.example.com/ domain which I want to redirect/rewrite to http://example.com/. Right now, loading www.example.com or example.com works, I guess because of the ServerName/ServerAlias.
Here's what I tried, and it doesn't work (the commented lines). First with rewrite then with redirect.
<VirtualHost *>
ServerName www.example.com
ServerAlias example.com
# Rewrite
# RewriteEngine On
# RewriteRule ^(.*) http://example.com.br$1 [R=301,L,NE]
# Redirect
# Redirect permanent / http://example.com
</VirtualHost>
Anyone knows the right syntax?
Many thanks!
RewriteEngine on
#
RewriteCond %{HTTP_HOST} ^www\.example\.com\.br [NC]
RewriteRule (.*) http://example.com.br$1 [R=301,L]
Jim