I'm having trouble with my apache config. Several sites are hosted on the server, each connected to a domain.
Here's an excerpt from the config:
<VirtualHost *:80> ServerName [name].com Redirect permanent / https://[name].com/ </VirtualHost> <VirtualHost *:80> ServerName www.[name].ch ServerAlias [name].ch Redirect permanent / https://www.[name].ch/ </VirtualHost> What's working:
- http requests to
[domain].comand[domain].chare redirected to https - http to
www.[domain].comis redirected tohttps://[domain].com https://www.[name].chif requested directly (so presumably no issue with ssl config)
What's not working:
- http to
www.[domain].chis redirected tohttps://[domain].cominstead ofhttps://[domain].ch
Requests to www.[name].ch are being returned with a 301 to https://[name].com.
apache2ctl -S lists all specified virtual hosts as expected.
Any hints as to what might be wrong with the config? I also had a look at this post (apache rewrite rules, non-www, https), which unfortunately didn't solve this problem.
curl -v http://example.comafter making changes in your config and restarting Apache