Do you think is this safe to have such manual record in Apache conf without anything else:
<VirtualHost 1.2.3.4:80 1.2.3.5:80> ServerName my-domain.ru ServerAlias www.my-domain.ru RedirectMatch /(.*)$ http://www.mydomain.ru </VirtualHost>
Nothing else but these strings and few strings in BIND?
Status:
Closed (fixed)
Comments
Submitted by andreychek on Wed, 04/03/2013 - 08:25 Comment #1
Sure, you can have an Apache section for redirecting, that shouldn't cause any problems.
However, when you setup a Virtual Server for my-domain.ru, it automatically includes "www" as part of that Virtual Server.
Rather than manually creating a new VirtualHost section in the Apache config for a redirect, you could always just make a .htaccess file in your my-domain.ru Virtual Server that looks like this:
RewriteCond %{HTTP_HOST} ^www.my-domain.ru [NC] RewriteRule ^(.*)$ http://my-domain.ru/$1 [L,R=301]
That will perform a redirect from the "www" version of the site to the non-www version.
I see! But it feels easier to do it directly!
Thanks!