• GoDaddy Community
  • Managed WordPress Hosting
  • Managed WordPress Hosting

    cancel
    Showing results for 
    Search instead for 
    Did you mean: 
    Go to solution
    Highlighted

    How to redirect old domain to new domain on HTTPS protocol in .htaccess

    As mentioned by a community manager in this post:  https://www.godaddy.com/community/Managing-Domains/Forwarding-from-HTTPS/m-p/126407/highlight/true#M..., the domain forward cannot be used for websites on the HTTPS protocol (which should be all websites in 2019).  So the solution is to set up redirects on the server. However, the  normal redirect methods that work on almost any other host are not working so how is one suppose to set up a redirect when using GoDaddy's Managed WordPress Hosting.

     

    This is what my .httaccess currently looks like:

     

    # BEGIN GD-SSL
    <IfModule mod_rewrite.c>
    Options +FollowSymLinks
    RewriteEngine On
    RewriteCond %{HTTPS} !=on
    RewriteCond %{HTTP_USER_AGENT} ^(.+)$
    RewriteCond %{SERVER_NAME} ^olddomain\.com$
    RewriteRule .* https://%{SERVER_NAME}%{REQUEST_URI} [R=301,L]
    Header add Strict-Transport-Security "max-age=300"
    </IfModule>
    # END GD-SSL
    
    # BEGIN WordPress
    <IfModule mod_rewrite.c>
    RewriteEngine On
    RewriteBase /
    RewriteRule ^index\.php$ - [L]
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule . /index.php [L]
    </IfModule>
    # END WordPress

     

    Using the recommended redirect found at: https://www.godaddy.com/help/using-301-page-redirects-234 which is:

    RewriteEngine on
    rewritecond %{http_host} ^coolexample.com [nc]
    rewriterule ^(.*)$ http://www.coolexample.com/$1 [r=301,nc]

    or a simple direct such as:

    Redirect 301 / https://newdomain.com/

    Will result in only one of 4 versions of my domain to be redirect:

     

    https://olddomain.com/  has no redirect

    https://www.olddomain.com/  redirects to https://olddomain.com

    http://olddomain.com/  redirects to https://olddomain.com

    http://www.olddomain.com/ redirect to https://newdomain.com

     

    Only the last version redirect to the new domain. How can I make all versions redirect to the new domain?

     

    1 REPLY 1
    Super User II
    Super User II
    Solution

    Re: How to redirect old domain to new domain on HTTPS protocol in .htaccess

    @HowtoDeeper 

     

    I see that this hasn't been replied to, so I figured I'd jump in.

     

    The Managed WordPress platform works slightly differently than your typical cPanel or VPS server as the domain mapping is handled at the platform level

     

    If I understand your post correctly you have

    1) olddomain.com and newdomain.com

    2) You have an SSL certificate for newdomain.com 

    3) You want to olddomain.com to forward to newdomain.com 

     

    Questions:

    1) What do you have setup as the primary URL www.newdomain.com or newdomain.com - you should check both the hosting panel and the general settings in WordPress - this will affect if you are seeing with or without the www

     

    2) Did you have an SSL certificate on olddomain.com - if so you more than likely will need to use a service like CloudFlare (free) to forward the old domain to the new domain - this is because the Managed WordPress platform only allows for the primary URL to have an SSL certificate and so when traffic comes in over a 2nd URL looking for HTTPS it doesn't redirect

     

    3) If you didn't have an SSL certificate for olddomain.com, I suggest using the Domain Forwarding feature in the GoDaddy Domain/DNS management 

     

     

     

     

     

     

    GoDaddy Pro User - Managing over 300 WP Sites