Making www and @ point to the same servername in apache

Sometime we just can’t control the client is accessing our website either
via www or just without www.

In virtualhost setting for apache this can be done by adding the following line into
httpd.conf

<VirtualHost *:80>
    ServerAdmin webmaster@namran.com
    DocumentRoot /home/namran/public_html/namran.com
    ServerName namran.com
    ServerAlias www.namran.com
 
    ErrorLog logs/namran.com-error_log
    CustomLog logs/namran.com-access_log common
 
</VirtualHost>

Get Free Email Updates!

Signup now and receive an email once I publish new content.

I will never give away, trade or sell your email address. You can unsubscribe at any time.

Like

Related Post

Anything to add?

X