It behooves you to make sure you’ve only got one URL that serves a given piece of content–so says google. But what if you’ve got a bunch of domains that go to your page?
For this blog, for example, matthew.mceachen.org, and mrm.mceachen.org all go to the same place. That was done with an apache redirect in /etc/apache2/sites-enabled/matthew:
<VirtualHost *:80> ServerName matthew.mceachen.org ServerAlias www.matthew.mceachen.us mrm.mceachen.org Redirect permanent / http://matthew.mceachen.us/ </VirtualHost>
If you want to redirect from one directory to another, PHP makes that pretty simple. This is the contents of my ~/public_html/index.php that directs people into my blog:
<?php header('Location: http://matthew.mceachen.us/blog/'); ?>
You can read more about 301 redirects on wikipedia.
Related posts:
- HOWTO: Force https with Amazon Elastic Load Balancer and Apache
The Amazon ELB service now supports https, which is great, but how do you configure Apache such that it redirects all insecure requests to use a secure connection? It turns......