i have about 10 domains on my server
site1.com
site2.com
site3.com
i want redirect non-www to www
from site1.com to www.site1.com
from site2.com to www.site2.com
Should i add htaccess for each site?
can i short this job in apache config?
i have about 10 domains on my server
site1.com
site2.com
site3.com
i want redirect non-www to www
from site1.com to www.site1.com
from site2.com to www.site2.com
Should i add htaccess for each site?
can i short this job in apache config?
The following entry in your Apache configuration for each domain would do the trick. Note that you should be doing a 301 (permanent) redirect to make sure the search engines understand that your www address is the canonical one.
<VirtualHost *:80>
ServerName example.com
ServerAlias *.example.com
Redirect 301 / http://www.example.com
</VirtualHost>