Digital Notepad

Internet, Mobility and Serious Geekery

301 Redirect in Apache2 VirtualHost Setting

August6

To come clean in terms of SEO and peace of mind don’t simply pont your domains to one IP and leave it like that. Be specific on the URL you want the spiders and your users to use! Decide if you want to go with www.tomschlenkhoff.com or etter tomschlenkhoff.com or tomschlenkhoff.de. Once you did, set up your VirtualHost files in the sites-available folder like that:

NameVirtualHost *

<VirtualHost *>
ServerName www.tomschlenkhoff.com
ServerAdmin blogmaster@tomschlenkhoff.com
DocumentRoot /var/www/tomschlenkhoff
ErrorLog /var/log/apache2/error.log
CustomLog /var/log/apache2/access.log combined
</VirtualHost>

<VirtualHost *>
ServerName tomschlenkhoff.com
ServerAlias tomschlenkhoff.de www.tomschlenkhoff.de
ErrorLog /var/log/apache2/error.log
CustomLog /var/log/apache2/access.log combined
RedirectMatch 301 (.*) http://www.tomschlenkhoff.com$1
</VirtualHost>

posted under Tech

Email will not be published

Website example

Your Comment: