Hi, On a default installation of CentOS (on AWS), I have the following configuration in my conf.d directory. So, besides for this configuration, I just have the default conf/httpd.conf file.
What I am trying to achieve is a configuration that: 1) If URL starts with http://www.example.com, it goes to http://example.com 2) If URL starts with https://www.example.com, it goes to https://example.com 3) If URL starts with either http://example.com or https://example.com, it stays the same. I was able to achieve #1 with the configuration below. However, to achieve #2, I have configuration that is currently commented out at the end. If I un-comment it, the server fails to start with the error message: Starting httpd: [Wed May 22 05:01:57 2013] [warn] *default* VirtualHost overlap on port 443, the first has precedence. I am a bit confused as I thought the docs said that *default* is just an alias for '*'. If I change both port 443 VirtualHost entries to say *:443, the server start up still fails with the same error as above. However, if I change both port 443 VirtualHost entires to say *default*:443, the server starts up, but https://www.example.com/ request stays the same and no redirect happens. Any ideas what I am doing wrong here and how to fix it would be highly appreciated! Thank you! -Yaakov. Here is the configuration: LoadModule ssl_module modules/mod_ssl.so Listen 443 NameVirtualHost *:80 <VirtualHost *:80> DocumentRoot /var/www/html/example.com ServerName example.com CustomLog "/var/log/httpd/example.com_log" common ErrorLog "/var/log/httpd/example.com_error_log" </VirtualHost> <VirtualHost *:80> ServerName www.example.com Redirect permanent / http://example.com/ </VirtualHost> SSLPassPhraseDialog builtin SSLSessionCache shmcb:/var/cache/mod_ssl/scache(512000) SSLSessionCacheTimeout 300 SSLMutex default SSLRandomSeed startup file:/dev/urandom 256 SSLRandomSeed connect builtin SSLCryptoDevice builtin <VirtualHost _default_:443> ServerName example.com DocumentRoot /var/www/html/example.com ErrorLog logs/tech_expl_ssl_error_log TransferLog logs/tech_expl_ssl_access_log LogLevel warn SSLEngine on SSLProtocol all -SSLv2 SSLCipherSuite ALL:!ADH:!EXPORT:!SSLv2:RC4+RSA:+HIGH:+MEDIUM:+LOW SSLCertificateFile /etc/pki/tls/.... SSLCertificateKeyFile /etc/pki/tls/.... SSLCertificateChainFile /etc/pki/tls/.... <Files ~ "\.(cgi|shtml|phtml|php3?)$"> SSLOptions +StdEnvVars </Files> <Directory "/var/www/cgi-bin"> SSLOptions +StdEnvVars </Directory> SetEnvIf User-Agent ".*MSIE.*" \ nokeepalive ssl-unclean-shutdown \ downgrade-1.0 force-response-1.0 CustomLog logs/ssl_request_log \ "%t %h %{SSL_PROTOCOL}x %{SSL_CIPHER}x \"%r\" %b" </VirtualHost> # VirtualHost to redirect to non-www domain #<VirtualHost *:443> # ServerName www.example.com # Redirect permanent / http://example.com/ #</VirtualHost>