Dns add www prefix?

Possible duplicate:
redirect apache from not www to www

Is it possible to configure DNS to add www. domain name prefix?

Here is an example of this

0
source share
3 answers

Nope. You must set up a web server at yourdomain.com to redirect to www.yourdomain.com .

For example, in apache you can use this configuration (using mod_alias ):

 <VirtualHost *:80> ServerName www.yourdomain.com ## Actual configuration here... </VirtualHost> <VirtualHost *:80> ## redirect non-www to www ServerName www.yourdomain.com ServerAlias yourdomain.com RedirectMatch permanent ^(.*) http://www.yourdomain.com$1 </VirtualHost> 
+1
source
  • You must add the NS A record to the DNS record for normalurl.com and www.normalurl.com
  • Enable mod_rewrite in Apache and create a .htaccess file with the following data:
 RewriteEngine On RewriteCond %{HTTP_HOST} !^www.normalurl.com$ [NC] RewriteRule ^(.*)$ http://www.normalurl.com/$1 [L,R] 
+1
source

The DNS response contains a mapping of a domain name to an IP address. Although you could use alias example.net on www.example.net with a CNAME record, this would not be visible to the user.

Most likely you want to configure your web server to send an HTTP 301 redirect to the correct URL.

0
source

Source: https://habr.com/ru/post/1446101/


All Articles