SSL and redirecting – new hosting

Home Forums Webmaster Discussion SSL and redirecting – new hosting

  • This topic is empty.
Viewing 8 posts - 1 through 8 (of 8 total)
  • Author
    Posts
  • #778 Reply
    conran
    Guest

    So I have yet another techie type question for all you eager brain-boxes out there

    We’re moving BlokeToys to a new hosting account, with our own cart and better back end (said the Bishop to the chamber maid ).
    We’re having to redirect a lot of URL’s because the structure has changed, for example /masturbators has now become /4-masturbators, and this applies to all products too, infuriatingly enough.

    In the process of moving, we’re also adding an SSL certificate to the system.

    So, my question is, how do we manage all the redirects with the new SSL? Do we redirect all the existing http: // links to their corresponding https: // links on the new site, or will this automatically happen when we do a standard redirect on each link using just http: //?

    As always, you glorious lovelies are appreciated for any assistance you can offer.

    #779 Reply
    Jay
    Guest

    Do as few redirects as possible.

    Assuming you’re using Apache – you’ll need something like what’s below in the .htaccess file in the root of your site. For every URL that’s changing (more than just HTTP to HTTPS), have a line specifying the old and new URL (like the first RewriteRule line in the code below). Then have a catch-all line that does all the other URLs that aren’t changing (the second RewriteRule line).

    <IfModule mod_rewrite.c>
    RewriteEngine On
    RewriteRule ^masturbators$ https://bloketoys.co.uk/4-masturbators [R=301,L]
    RewriteRule ^(.*)$ https://bloketoys.co.uk/$1 [R=301,L]
    </IfModule>
    #781 Reply
    Bec
    Guest

    Can’t you just build the new site and leave bloketoys.com online until it is finished? Then do one re-direct of the entire bloketoys domain to the new one. Or is this not a new name? I don’t think you can have 2 accounts active with the same domain name, DNS doesn’t allow that. (or does it?)

    #782 Reply
    conran
    Guest

    I can to a standard url 301 redirect manually through cPanel without having to go into the .htaccess, and we plan to only do this on pages/products getting more attention than 10 hist over a two month period, to minimize the work.

    The problem is I don’t know whether we need to be redirecting all those old url’s to https: // url’s or leave them as http: //. Does the existence of an SSL automatically make http: // url’s, or would I then need to add a redirect after the fact?

    #783 Reply
    conran
    Guest

    @Bec

    It’s a little more complex.
    We’re keeping the domain, we have the hosting with that domain set up on a new server with Prestashop. The DNS hasn’t been changed yet, so we’re working on the new site from the back office (for which we had to add a local redirect on my HOSTS file, so it shows the new site and not the old one which is still active).

    Indeed we can’t have two sites with the same domain name, which is why the new one isn’t active, in that it hasn’t had the DNS directed to it yet. If we could have just duplicated everything on the new domain, all we would then need to do is point the old URL to the new DNS. But, because every URL is now going to be different, we have to redirect each one.

    As we also have our own SSL to install (the other was a shared SSL on selected cart pages) we have the added confusion of not knowing what to direct the url’s to.

    For instance, if we need to now direct the old http: //bloketoys.co.uk/masturbators to the new https: //bloketoys.co.uk/4-masturbators, do we type in the https:// or leave it as http://

    Will the SSL automatically make all existing http pages https, and if we add https into the new url for the redirected pages, will the SSL then break the site trying to add httpss: ?

    This is all becoming far more confusing than I expected, although I should have expected it.

    #784 Reply
    mountequinox
    Guest

    No.. You will need to redirect all http traffic to https via .htaccess. If you don’t have the redirect then http traffic will be served for any old links pointing to your site that don’t have a correct redirect configured within .htaccess.

    This rule will check to make sure all connections are using https.

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

    Place it at the bottom of your .htaccess file as a catch all in case you miss something in your other redirects above it.

    Hope that helps.
    Kevin.

    #785 Reply
    conran
    Guest

    Excellent Kevin, thanks for that. This is what we needed to know, so that we can continue to add the redirects now before the SSL is installed, then simply add the one redirect at the end to transfer all http to https.

    And thanks for the input from other board members too. I know it’s a very complex and confusing situation, and I know I didn’t explain it as thoroughly as I perhaps could have. Your input is appreciated!

    #11739 Reply
    Brandynette Damm
    Guest

    Considering this Blog Post is 6 years old then i must say im super happy with my cpanel
    namecheapĀ“s SSL automatically install a new certificate each year & its free!

    on the other hand, if you are using apache2 on a debian then installing 6 setting up cerbot SSL is also super easy & has many tutorials

Viewing 8 posts - 1 through 8 (of 8 total)
Reply To: SSL and redirecting – new hosting
Your information: