Mystery redirect of domain.com to https://www.domain.com – what could be causing it?

0

Issue

I am using apache on Centos and whenever I use domain.com it gets redirected to https://www.domain.com

In general this is fine, but we have an alias domain for the server, domain2.com, which should keep its domain name (ie not add https//www.), but some part of the config is re-mapping this to https://www.domain2.com

I have checked httpd.conf and the .htaccess in the web app directory, but there dont seem to be any Rewrite or Redirect commands doing this. I have also checked the various include files cpanel/EasyApache uses…

domain2.com is configured as a ServerAlias for the main site.

UPDATE:
The main site is written with CakePHP – I can see its doing the “if not SSL, redirect to https”, but still tracking down where the “www.” is coming from for the other domain.

UPDATE2:
There was another .htaccess below the app/webroot directory which was doing a redirect of non-www url’s to the www. version.

Apache version info:

Server version: Apache/2.2.17 (Unix)
Server built:   Apr 20 2011 16:37:37
Cpanel::Easy::Apache v3.2.5 rev9999
Server's Module Magic Number: 20051115:25
Server loaded:  APR 1.4.2, APR-Util 1.3.10
Compiled using: APR 1.4.2, APR-Util 1.3.10
Architecture:   64-bit
Server MPM:     Prefork
  threaded:     no
    forked:     yes (variable process count)
Server compiled with....
 -D APACHE_MPM_DIR="server/mpm/prefork"
 -D APR_HAS_SENDFILE
 -D APR_HAS_MMAP
 -D APR_HAVE_IPV6 (IPv4-mapped addresses enabled)
 -D APR_USE_SYSVSEM_SERIALIZE
 -D APR_USE_PTHREAD_SERIALIZE
 -D SINGLE_LISTEN_UNSERIALIZED_ACCEPT
 -D APR_HAS_OTHER_CHILD
 -D AP_HAVE_RELIABLE_PIPED_LOGS
 -D DYNAMIC_MODULE_LIMIT=128
 -D HTTPD_ROOT="/usr/local/apache"
 -D SUEXEC_BIN="/usr/local/apache/bin/suexec"
 -D DEFAULT_PIDLOG="logs/httpd.pid"
 -D DEFAULT_SCOREBOARD="logs/apache_runtime_status"
 -D DEFAULT_LOCKFILE="logs/accept.lock"
 -D DEFAULT_ERRORLOG="logs/error_log"
 -D AP_TYPES_CONFIG_FILE="conf/mime.types"
 -D SERVER_CONFIG_FILE="conf/httpd.conf"

Many thanks in advance for any hints/tips.

Regards,
Chris

Solution

Redirection could appear in page code, proxy/firewall/checkpoint of any is used, hosts file or DNS server where your domain.com is servered.

HTH

Ivo Stoykov

Answered By – i100

This Answer collected from stackoverflow, is licensed under cc by-sa 2.5 , cc by-sa 3.0 and cc by-sa 4.0

Leave A Reply

Your email address will not be published.

This website uses cookies to improve your experience. We'll assume you're ok with this, but you can opt-out if you wish. Accept Read More