Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

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

like image 806
Chris Kimpton Avatar asked Dec 05 '25 01:12

Chris Kimpton


1 Answers

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

like image 52
i100 Avatar answered Dec 06 '25 16:12

i100



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!