2

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

I want to enforce SSL site-wide.

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

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

2

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]
1

You can configure it in your VirtualHost 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@example.com
        ServerName example.com
        Redirect / https://example.com/
</VirtualHost>

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.