I have an existing domain at http://example.com and wish to move it to https://example.com
How can I have the redirection with a 301 to maintain rankings etc?
Kevin
I have an existing domain at http://example.com and wish to move it to https://example.com
How can I have the redirection with a 301 to maintain rankings etc?
Kevin
It’s actually really simple.
Assuming you’re using Apache, you include the following in your vhosts:
<VirtualHost *:80>
ServerName example.com
Redirect permanent / https://example.com
</VirtualHost>
That will ensure any HTTP (port 80) traffic finds the correct site. I’m using the above in my Apache 2.4 setup (which is basically identical to what I had in my old 2.2 setup).
I have no idea how you do it with Nginx
Good luck!
EDIT: According to Wikipedia, Nginx is quite simple too:
location /old/url/ {
return 301 /new/url;
}
EDIT2: The “Redirect permanent” in the Apache example is the 301 you’re after. That will ensure all crawlers know the rankings for example.com now apply to https://example.com. Without the “permanent”, a 302 is applied instead, and no ranking will be transferred.
I have done a 301 redirect in Nginx, the redirect is working but it is going to the plesk default page not the domain
have I missed something?
RewriteEngine on RewriteCond %{HTTPS} !=on RewriteRule ^(.*)$ https://%{SERVER_NAME}%{REQUEST_URI} [R,L,QSA]