Configuring 301 HTTP to HTTPS Redirects on Apache

Ok so I have Installed on a dev server /domain using plesk and webserver partner

and redirecting using 301

RewriteEngine on RewriteCond %{HTTPS} !=on RewriteRule ^(.*)$ https://%{SERVER_NAME}%{REQUEST_URI} [R,L,QSA]

However it is just going to a default page on the server

www.dottvmedia.tv

Hi wizwiz,

do you have a correct DocumentRoot?

After redirecting to https, you need a https vhost aswell, i think. Do you have terminal access?
What’s your Webserver? nginx, apache or anything else?

greetz Sm3rT

1 Like

Hi,

in my root tree I have

var/www/vhosts/dottvmedia.tv/httpsdocs which has the default index do i need to copy all the site to that directory?

Hey @wiziwiz,

if that is your DocumentRoot: “/var/www/vhosts/dottvmedia.tv/httpsdocs”

You have to put all data that you wanna serve in that directory.

By the Way, you can use same DocumentRoot for http and https.

Greetz Sm3rT

1 Like

Ok that worked!

is there an other way apart from copying everything to the other directory?

Can you find the place in the web server configuration that says to use httpsdocs and simply change it to point at the same document root as your HTTP site?

1 Like

The only place I have the redirect is here

RewriteEngine on
RewriteCond %{HTTPS} !=on
RewriteRule ^(.*)$ https://%{SERVER_NAME}%{REQUEST_URI} [R,L,QSA]

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.