Redirect domain from www on Apache

First locate the virtual host configuration file for Apache related to the domain, on FreeBSD it should be here:

  1. cd /usr/local/etc/apache/vh

Now add following in between the begin <VirtualHost *> and end </VirtualHost>

  1. RewriteEngine on                                                                                
  2. RewriteCond %{HTTP_HOST} ^www\.(.*)                                                            
  3. RewriteRule ^/(.*)$ http://klauskjeldsen.dk/$1 [R=301]


Related Articles:

This entry was posted in Web Development. Bookmark the permalink.

Leave a Reply

Your email address will not be published. Required fields are marked *

*

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>