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

3 Responses

  1. HawkEYE says:

    I got better one after a few minute..
    by adding this two line before line 602 (/usr/share/system-config-network/netconfpkg/gui/maindialog.py)


    if (not isinstance (host.Hostname, str)):
    continue

    now it works like charms again.. hehe.. 😎

    Reply
  2. UncleOp says:

    This was helpful. Summary: if the /etc/hosts file is not well-formed, the python script doesn’t handle it well. In my case, somehow a long entry that was commented out got “line wrapped”, leaving some uncommented garbage on the next line. Fixing the hosts file or adding the above patch “worked”. It seems that some complaint to the user should be generated in such a case, though.

    Reply
    • HawkEYE says:

      @UncleOp , Glad it help.. thanks for dropping by..

      Reply

Anything to add?

X