Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have a Debian/Linux Lenny LAMP server w/Plesk Panel 10.2. I have a PHP/MySQL webapp deployed in a Plesk "webspace".

I want to enforce SSL on site-wide.

Do I just forward port 80 to 443? For my single domain cert, do I forward www.domain.com to domain.com or do I forward domain.com to www.domain.com?

Should this happen with .htaccess or some vhost config file?

share|improve this question

I would use mod_rewrite.

Enable mod_rewrite and add something like this to your vhost config

RewriteEngine on
RewriteCond %{HTTPS} !On
RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI} [R=301]
share|improve this answer

You can configure it in your vhost config. For example have a VirtualHost for the HTTP protocol on port 80 that redirects your users to the HTTPS version:

<VirtualHost *:80>
        ServerAdmin you@domain.com
        ServerName domain.com
        Redirect / https://domain.com/
share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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