htaccess issue on codeigniter setup on ubuntu
<pre><code>    My website open properly when I type `www.abc.com` on browser but when I type `abc.com` it opens page of subdomain which I have hosted which is `admin.abc.com`.

    But the url still says `abc.com`

    Here is my .htaccess code:

    &lt;!-- language: lang-bash --&gt;

        RewriteEngine on
        RewriteBase /
        RewriteCond %{HTTP_HOST} !^www\. [NC]
        RewriteRule ^(.*)$ http://www.%{HTTP_HOST}/$1 [R=301,L]

    I am using Ubuntu 14.04 with Apache and have configured virtual hosts for both domains.
    Any guidance will be highly appreciated.
</code></pre>

<p>Here is my conf file for abc.com which is uploaded on the server for both domain and sub-domain.</p>

<pre><code>    &lt;!-- language: lang-bash --&gt;
    # domain: abc.com
    # public: /var/www/abc.com/public_html/

    &lt;VirtualHost *:443&gt;
      SSLEngine On
      SSLCertificateFile /etc/ssl/localcerts/c8d39f3574580de6.crt
      SSLCertificateKeyFile /etc/ssl/localcerts/abc.key
      SSLCertificateChainFile /etc/ssl/localcerts/gd_bundle-g2-g1.crt

      &lt;Directory /var/www&gt;
      Options Indexes FollowSymLinks MultiViews
      AllowOverride All
      Order allow,deny
      allow from all
      &lt;/Directory&gt;

      # Admin email, Server Name (domain name), and any aliases
      ServerAdmin admin@abc.com
      ServerName  abc.com
      ServerAlias abc.com

      # Index file and Document Root (where the public files are located)
      DirectoryIndex index.html index.php
      DocumentRoot /var/www/abc.com/public_html
      # Log file locations
      LogLevel warn
      ErrorLog  /var/www/abc.com/log/error.log
      CustomLog /var/www/abc.com/log/access.log Combined
    &lt;/VirtualHost&gt;
</code></pre>

<p>Here is my conf file for admin.abc.com</p>

<pre><code>&lt;!-- language: lang-bash --&gt;

# domain: admin.abc.com
# public: /var/www/admin.abc.com/public_html/

&lt;VirtualHost *:80&gt;
  # Admin email, Server Name (domain name), and any aliases
  ServerAdmin admin@abc.com
  ServerName  admin.abc.com
  ServerAlias admin.abc.com

  # Index file and Document Root (where the public files are located)
  DirectoryIndex index.html index.php
  DocumentRoot /var/www/admin.abc.com/public_html
  # Log file locations
  LogLevel warn
  ErrorLog  /var/www/admin.abc.com/log/error.log
  CustomLog /var/www/admin.abc.com/log/access.log combined
&lt;/VirtualHost&gt;
</code></pre>

<p>do let us know if above conf files where helpful to determine the issue, Looking forward to your response.</p>