I want to ensure that several variations of http://*.mydomain.*/* gets redirected to https://mydomain.com/*.
No problem, the following part of httpd.conf takes care of that:
Quote:
<Virtualhost 12.34.56.78:80>
ServerName www.mydomain.com
ServerAlias mydomain.co.uk
ServerAlias www.mydomain.co.uk
Redirect permanent / https://mydomain.com/
</VirtualHost>
<Virtualhost 12.34.56.78:443>
DocumentRoot /var/www/html/mydomain.com
ServerName mydomain.com
...
</VirtualHost>
|
So far so good - but I also want to make sure that any traffic to https://www.mydomain.com/* gets redirected to https://mydomain.com/* (partly to prevent certificate errors, partly to ensure Google only sees one website).
I can't add another Virtualhost container for this, Apache won't have that.
I can add a .htaccess file in the website, but that won't catch any links to subdirectories (i.e. https://www.mydomain.com/blah/ will not get caught unless I drop a .htaccess file in each and every directory, not an optimal solution).
How can I ensure traffic to https://www.mydomain.com/* gets redirected to https://mydomain.com/* ? I'm sure there must be a way to do this?
Recent comments
8 hours 14 min ago
17 hours 41 min ago
18 hours 31 min ago
22 hours 4 min ago
1 day 2 hours ago
1 day 2 hours ago
1 day 5 hours ago
1 day 15 hours ago
1 day 20 hours ago
1 day 21 hours ago