• Sign in to Neowin Faster!

    Create an account on Neowin to contribute and support the site.

  • 0
Sign in to follow this  

Question about redirects (http://www to https://non-www)


M_Lyons10    454

Good morning everyone!


Redirects and web.config changes still make me extremely nervous, so I always like to ask before I actually do anything.


We recently upgraded to https and I set up a redirect from http to https.  The problem I am having is that it is redirecting multiple times.  From http://www to http://non-www and then again from http://non-www to https://non-www.


How can I redirect once?  I've noticed a speed impact from doing it this way.


So, I would like to redirect both http://www and http://non-www to https://non-www for the entire domain.


I do have a couple of pages that have been redirected invidivually as well because the page has moved.


I'm using Windows hosting.


Here is my htaccess:


#Redirect from WWW to non WWW
RewriteEngine On
RewriteCond %{HTTP_HOST} ^www.[mysite].com [NC]
RewriteRule ^(.*)$ https://[mysite].com$1 [L,R=301]


Thank you again for your help!

Share this post

Link to post
Share on other sites

1 answer to this question

Recommended Posts

  • 0
+Kyle    98
RewriteEngine On
RewriteCond %{HTTP_HOST} ^www.[mysite].com$ [NC]
RewriteRule ^(.*)$ https://[mysite].com/$1 [R=301,L]
RewriteCond %{HTTPS} off
RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI} [R,L]

You were super close.

Share this post

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

  • Recently Browsing   0 members

    No registered users viewing this page.