I'm trying to set up my apache server to redirect domain.com to www.domain.com and I am having troubles. To save me re-posting where I'm at and what I've tried here is a link to my existing post on LQ.


1 Answer 1


All you need to do is to add redirect line to /etc/apache2/sites-available/domainname.vhost file for example:

<VirtualHost *:80>
    ServerName example.com
    Redirect permanent / http://www.example.com/

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.