Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

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
add comment

2 Answers

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
add comment

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/
</VirtualHost>
share|improve this answer
add comment

Your Answer

 
discard

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.