Forum Moderators: Robert Charlton & goodroi

Message Too Old, No Replies

Client switching from http to https worried about 301 redirects

         

Copywriter39

2:27 am on Mar 18, 2015 (gmt 0)

10+ Year Member



I have client with a large ecommerce site and he is preparing to switch over to https. He wonders if he needs to have a 301 redirect from every page to the new urls. Is this necessary or is there a shortcut.

not2easy

2:45 am on Mar 18, 2015 (gmt 0)

WebmasterWorld Administrator 10+ Year Member Top Contributors Of The Month



It should be one simple redirect for all pages if the only change is http to https, it is basically the same kind of redirect they have (probably) had in place to redirect www/non-wwww URLs. It might be more complicated depending on the site's URL structure.

Copywriter39

5:49 am on Mar 18, 2015 (gmt 0)

10+ Year Member



I've heard from others that they had to do each page as a 301. It would be much easier if he could do it this way.

not2easy

6:03 am on Mar 18, 2015 (gmt 0)

WebmasterWorld Administrator 10+ Year Member Top Contributors Of The Month



You can read a few recent posts around the forum on this topic, it has been a question concernning a lot of sites. See this one: [webmasterworld.com...]

The site owner should be prepared for a period of adjustment in the serps, but traffic can continue while the new changes get indexed if 301 redirects are used so that traffic landing on the existing pages will automatically be shown the new pages. A 301 tells search engines that the page has permanently moved, this is the new address. It preserves traffic from links around the net too and from visitors who have bookmarked the site.

lucy24

6:14 am on Mar 18, 2015 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



I've heard from others that they had to do each page as a 301.

You mean, a separate line of code for every single page? Maybe your friends did a complete site redesign where there was no relationship between old URL and new URL (and, uh, it didn't occur to them to throw it into a php-or-equivalent script instead of clogging up the config file?).

Redirecting to https is almost exactly the same as the domain-name canonicalization redirect that you've already got. Exact wording will depend on your server, but it can't possibly be more than two or three lines total.

netmeg

12:27 pm on Mar 18, 2015 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



I've heard from others that they had to do each page as a 301. It would be much easier if he could do it this way.


Why? It's much easier to do it with one sitewide redirect, and if you have the access to implement the page by page, you have the access to do the sitewide. I'm not understanding.

lucy24

6:48 pm on Mar 18, 2015 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



I'm not understanding.

I kinda suspect that when he said "this way" he really meant "that way", i.e. the previously cited all-in-one-line way.

Copywriter39

7:23 pm on Mar 18, 2015 (gmt 0)

10+ Year Member



When I mentioned I heard from others it was in response to this same question on other forums. A couple of the responses said it would be necessary to do a 301 for each page. This didn't seem correct to me, which is why I posted that question here.

aakk9999

11:17 pm on Mar 18, 2015 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



not2easy: It should be one simple redirect for all pages if the only change is http to https,
Correct :)

Copywriter39: A couple of the responses said it would be necessary to do a 301 for each page
Also correct :)

Both statements are correct, but the problem is in terminology used. Because one simple redirect rule affecting all pages on the site will redirect each page from http to its https URL.

not2easy

1:32 am on Mar 19, 2015 (gmt 0)

WebmasterWorld Administrator 10+ Year Member Top Contributors Of The Month



Thank you aakk9999, you knew what I meant. :)

One rule can handle redirecting every page - if the old pages and the new pages have the same URLs they had before other than the https: part. In that case one rule will redirect every page to its new https page.

IF each old page has a new page with a completely different name, you cannot do that with a single rule. Then you look into the solution lucy24 mentioned where a php file sorts it all out for you. (I'm no help with that one, I've never looked at the solution.)

For example, if the current URL is
http://www.example.com/pages/anything/blue.html

and the new URL is
https://www.example.com/pages/anything/blue.html

your rule captures everything in the requested URL and changes only the http: part to https: and visitors see the new page.

The same rule will change
http://www.example.com/category/blue/round.html

to
https://www.example.com/category/blue/round.html


But if the old page is
http://www.example.com/category/blue/round.html

and the new page is
https://www.example.com/12345/category/pages/round/blue.html

then you will need more than one rule.

lizardx

8:18 pm on Mar 23, 2015 (gmt 0)

10+ Year Member



# https://wiki.apache.org/httpd/RewriteHTTPToHTTPS
# This checks to make sure the connection is not already HTTPS
RewriteCond %{HTTPS} !=on
# This rule will redirect users from their original location, to the same location but using HTTPS.
RewriteRule ^/?(.*) https://%{SERVER_NAME}/$1 [R=301,L]


One rule, assuming no other changes. Note of course also that https usually is linked only to either the www. or non www. version of the domain name, so you need to redirect to the actual domain that https is assigned to, unless you got the full https package for all covered subdomains etc, which is expensive and largely pointless unless you actually use subdomains.

Easier to just make the domain www.domain.com and then have that be https.

I'm assuming Apache of course here.