Configuring 301 HTTP to HTTPS Redirects on Apache


#1

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


#2

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


#3

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?


#4

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


#5

Ok that worked!

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


#6

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?


#7

The only place I have the redirect is here

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


#8

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