• 0

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


Question

M_Lyons10

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!

Link to post
Share on other sites

7 answers to this question

Recommended Posts

  • 0
+Kyle
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.

Link to post
Share on other sites
  • 0
M_Lyons10
On 6/13/2019 at 9:09 PM, Kyle said:

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.

Thank you very much for your help, I really appreciate it and will try that out right away.

I apologize for the delay in getting back to this, I had some unexpected health issues and I'm just getting back to this now.

 

Thank you again!

Link to post
Share on other sites
  • 0
M_Lyons10

Thank you very much for your help.  I tried your suggestion yesterday and while it redirects from www to https non-www, if I type the non-www web address I get an error that the the website sent an invalid response "ERR_INVALID_REDIRECT".

 

Is there something that I might be missing?  I want to redirect all traffic to https://non-www but with as few redirects as possible.

  • http://www
  • http://non-www
  • https://www
  • https://non-www

Thank you again for all of your help, I greatly appreciate it and I want to apologize again for being taken away from this thread due to some issues that were beyond my control.  But I am back to 100% and will be checking back regularly now.

 

Thanks Again,

Link to post
Share on other sites
  • 0
Tantawi

Try this, this is what I use on all my sites since a long time and works great! Only one redirect with multiple conditions.

 

RewriteEngine On
# Remove www & Force HTTPs
RewriteCond %{HTTP_HOST} ^(www\.)(.+) [OR]
RewriteCond %{HTTPS} off
RewriteCond %{HTTP_HOST} ^(www\.)?(.+)
RewriteRule ^ https://%2%{REQUEST_URI} [R=301,L]

 

Link to post
Share on other sites
  • 0
M_Lyons10
On 8/7/2019 at 5:32 PM, Tantawi said:

Try this, this is what I use on all my sites since a long time and works great! Only one redirect with multiple conditions.

 


RewriteEngine On
# Remove www & Force HTTPs
RewriteCond %{HTTP_HOST} ^(www\.)(.+) [OR]
RewriteCond %{HTTPS} off
RewriteCond %{HTTP_HOST} ^(www\.)?(.+)
RewriteRule ^ https://%2%{REQUEST_URI} [R=301,L]

 

Thank you very much for posting that.  I tried it and while it is redirecting www to https://non-www, I noticed that if I try to go to the non-www domain I get the following error:

This page isn’t working disasterblaster.com sent an invalid response.
ERR_INVALID_REDIRECT

I'm assuming this works for you though?  I feel like there is something I'm missing here...

Thank you again!

Link to post
Share on other sites
  • 0
Tantawi
3 hours ago, M_Lyons10 said:

Thank you very much for posting that.  I tried it and while it is redirecting www to https://non-www, I noticed that if I try to go to the non-www domain I get the following error:

This page isn’t working disasterblaster.com sent an invalid response.
ERR_INVALID_REDIRECT

I'm assuming this works for you though?  I feel like there is something I'm missing here...

Thank you again!

Did you fix it? all scenarios works great with me! You may want to try in another browser or in incognito window to make sure nothing is cached form old redirects.

Link to post
Share on other sites
  • 0
M_Lyons10
On 8/9/2019 at 6:08 PM, Tantawi said:

Did you fix it? all scenarios works great with me! You may want to try in another browser or in incognito window to make sure nothing is cached form old redirects.

Good morning.

I ended up restoring the old web.config / htaccess files.  I did work with the example you provided for a bit, but I didn't want to leave the site partially down and couldn't figure out why it wouldn't work.  I'm by no means an expert on htaccess or web.config (which is why I am so reluctant to play around with it), but reading through what you have it seemed to make sense to me.

 

I'm not sure where I should go from here.  Google is saying that I should have less redirects, but nothing I seem to try works...

Thank you very much for your help though, I do really appreciate it.

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
  • Recently Browsing   0 members

    No registered users viewing this page.

  • Similar Content

    • By Abhay V
      Microsoft posts a workaround for the 'Reset this PC' bug plaguing some Windows 10 PCs
      by Abhay Venkatesh



      Microsoft offers an in-built solution to reset a Windows 10 PC through the Settings app if users choose to do so due to a corrupt build or issues with the operating system. The tool also gives users the choice to keep their files and only reset the OS settings to factory default. However, the feature might not be working as expected for some users running Windows 10 version 2004.

      The company today posted a support article acknowledging the issue with the ‘Reset this PC’ feature that causes the tool to fail and prompt an error that reads “There was a problem when resetting your PC. No changes were made". The company also posted a workaround for users who are unable to use the feature and are experiencing the said error.

      Here is the workaround as shared by Microsoft:

      The workaround involves using the Deployment Image Servicing and Management (DISM) tool to attempt to fix the issue. However, Microsoft does not mention any timelines on when a permanent fix for the problem is expected.

      Interestingly, this is not the first time that the problem with the ‘Reset this PC’ feature has been acknowledged. A security update back in February introduced a similar issue and affected Windows 10 versions all the way back to version 1809. The update was then pulled by the company. While today’s documentation only mentions the May 2020 Update, it is not clear if the problem has been fixed for the earlier versions.

      Source: Microsoft Support via BleepingComputer

    • By Abhay V
      Here's how you can install the Windows 10 October 2020 Update right now
      by Abhay Venkatesh



      Microsoft began rolling out the Windows 10 October 2020 Update this week, bringing a few new features such as a refreshed Start Menu design that is now theme-aware, improvements to the notifications interface, Alt+Tab multitasking enhancements for the Edge browser, and more. You can read through the complete list of features here.

      The update is not a major one since the features are already baked into the May 2020 Update (version 2004). The 20H2 release, just like version 1909, is an enablement package that lights up the hidden features in the OS – which installs just like a monthly cumulative update – unless you are upgrading from a release older than version 2004. However, as is the case with recent releases, Microsoft is performing a staggered rollout of the update, so not all users will receive the update immediately.

      If you want to check if the update is being offered to you, or install it regardless if it isn’t, here are some ways you can go about downloading and installing the October 2020 Update.

      Through Windows Update
      The way most users update their PCs is through Windows Update. Unlike older versions, feature updates are no longer force installed until the currently installed version reaches the end of support. To check if the October 2020 Update is ready to be installed through Windows Update, perform the following steps:

      Head to Settings (via the Start Menu or the Win + I shortcut) Click on Update & Security Click on Windows Update Click on Check for Updates If the feature update is available to install, a card with a Download and install now prompt will be available (example screenshot below) For users running version 2004, the update package will be a quick download. However, those on older versions of the OS will go through the full-fledged download and install process that will take much longer. Since Microsoft is gradually rolling out version 20H2, not many people will see the update show up right away, including those running the May 2020 Update – even though the two versions are technically the same.

      Users upgrading from older versions could be blocked from being served the update owing to incompatibilities such as driver version conflicts or more. The known issues and update blockers are documented here. These users will be prompted for an upgrade when their devices are “ready”.

      For those that do not see a prompt in Windows Update, there are a couple of other options to install version 20H2. However, it must be noted that forcing an update through these methods could cause problems due to incompatible drivers, so it is advised that you go ahead with these methods only if you are aware of the risks and are familiar with rolling back feature updates, in case something goes wrong. It is always a good idea to perform a backup of your data as well.

      Using the Update Assistant
      The Update Assistant allows users to perform an in-place feature update through a wizard. It must be noted, however, that the tool downloads the entire OS package regardless of what version you are on. So even if you are upgrading from the May 2020 Update, the tool will perform the complete installation process instead of applying the enablement package.

      The tool also checks for major compatibility issues and can block the user from updating to the latest version of Windows 10 if there are any major issues. You can head to the download page here and click on the Update Now button to download the Update Assistant. Then, perform the following steps to initiate the update:

      Download and open the Update Assistant and hit Update Now Though the company updated the naming convention for the version number starting with this release, the tool specifies a certain "version 2009", which is nothing but the October 2020 Update (20H2) Hit Next if the tool certifies your PC as compatible Let the tool complete the download and initialization process for the update The tool will then prompt for a restart Unlike Windows Update, it is possible that dismissing the restart prompt could immediately trigger a restart and the wizard might not obey your pre-set active hours. It is best for you to keep an eye on the progress and save all your work beforehand. The system will then restart multiple times and then boot into version 20H2.

      Using the Media Creation tool
      Users that are upgrading from older versions of Windows 10 or those who want to perform a clean installation can also use the media creation tool. You can head to the download page here and click the Download tool now button under the Create Windows 10 installation media section. The tool lets users perform an in-place update for their own system or create bootable media for use on other PCs or virtual machines. The installation media can also be used as a means to install Windows 10 on new, custom-built machines or bricked devices.

      For this guide, we will cover the steps needed to be performed to initiate an in-place upgrade for users’ own machines. Here are the steps to be performed:

      Download and open the Media Creation tool Accept the license terms If you want to upgrade your PC, choose the Upgrade this PC now option Let the tool download and run the update process Follow further instructions to restart the system Just like with the Update Assistant, the system should go through a series of restarts for the update to be installed. If you want to create an installation media for backup purposes or creating a bootable disc for another PC, here is how you do it:

      Under the What do you want to do? step, choose the Create installation media… option Either use the recommended option or select the desired language, edition, and architecture Choose the kind of media you want to create Do note that a USB flash drive must be 8GB in capacity or larger. You can save the ISO file locally if you wish to use it to set up Windows 10 on a virtual machine.

      If you are not offered the update via Windows Update and are facing hiccups with getting through the compatibility checks in either of the tools, it is best to give it some time. The Redmond company constantly serves cumulative updates to fix bugs and remove update blocks and will offer the update to compatible devices when it deems the configuration ready.

    • By Rich Woods
      Parallels Desktop lets you run Windows on Chrome OS starting today
      by Rich Woods

      After announcing its partnership with Google back in June, Parallels is now available for Chromebook Enterprise users. That's right; you can now run Windows on Chrome OS, no internet connection required. Everything is running locally in a virtual machine.

      The issue of running Windows on Chrome OS solves a big problem for businesses. If nothing else, it allows you to run those last few apps that your business needs. If the Office web apps aren't enough, you can easily run full Office in Parallels. Or, you can run your business's proprietary apps.

      "Chrome OS is increasingly being chosen by modern enterprises, either for remote work, hybrid, or in the office," said John Solomon, Vice President of Chrome OS at Google. "We are thrilled to partner with Parallels to bring legacy and full-featured Windows applications support, through Parallels Desktop for Chromebook Enterprise, to help businesses easily transition to cloud-first devices and workflows."

      Parallels worked on a lot of integrations with Chrome OS, and it did this by using its own software. The team used Parallels on Chromebook Enterprise, and continued to make feature requests. After all, no one will want the Windows and Chrome OS to be completely isolated from each other.

      You can easily share files between Chrome OS and Windows. In Chrome OS, you can easily find your Windows files, and then you'll find the common folders like Downloads, Documents, Pictures, and so on. To open Chrome OS files in Windows, you have to opt to share a file or folder with Windows with Google Drive. Windows apps are also integrated into 'Open with', so for example, you can choose to open a Word document from Chrome OS into Windows via Parallels.

      "Parallels Desktop for Chromebook Enterprise incorporates more than 22 years of Parallels’ experience innovating software that makes it simple for people to seamlessly run multiple operating systems and applications on any device, to be more productive," said Nick Dobrovolskiy, Senior Vice President of Engineering and Support for Parallels. "In addition to simultaneously running Windows and its full-featured apps alongside Chrome OS apps directly on a Chromebook, Parallels Desktop integrates a variety of useful features: Copy and paste text and graphics between Windows 10 and Chrome OS; frustration-free printing from Windows apps via shared Chrome OS printers or from printers that are only available for Windows 10; and the option to save Windows files locally on a Chromebook, in the cloud, or both."

      Being that it's a virtual machine that you're running, it can save its state. That means that you can quickly pick up where you left off.

      Parallels Desktop for Chromebook Enterprise is available now, and it costs $69.99 per year per user. You do need a Windows license, of course, and you'll need a Chromebook that has an Intel Core i5 or i7, 16GB RAM, and 128GB of storage. Initially supported devices include the HP Elite c1030 Chromebook Enterprise, HP Pro c640 Chromebook Enterprise, Google Pixelbook, Google Pixelbook Go, Acer Chromebook Spin 713, Acer Chromebook Spin 13, Dell Latitude 5300 2-in-1 Chromebook Enterprise, Dell Latitude 5400 Chromebook Enterprise, Lenovo Yoga C630 Chromebook, and ASUS Chromebook Flip C436FA.

    • By Jay Bonggolto
      Microsoft outlines 10 app store principles in a jab at Apple
      by Jay Bonggolto

      Microsoft today introduced a set of 10 principles that it will use to steer its app store policies for developers. The software giant says the principles aim "to promote choice, ensure fairness, and promote innovation on Windows 10".

      In a blog post outlining these principles, Rima Alaily, Microsoft's Vice President and Deputy General Counsel, reiterated that Windows 10 is an open platform where "developers are free to choose how they distribute their apps".

      The 10 principles are as follows:

      These principles aren't new, though. Microsoft has long been providing developers a way to distribute their apps and games the way they like. Also, Microsoft Store isn't the only distribution option available to developers on Windows, with Steam and Epic already available on the platform. That said, these principles don't apply to the Xbox store since Microsoft "operates on a different set of rules" when it comes to that platform.

      The principles build upon the work of the Coalition for App Fairness (CAF), which was launched in September by Epic Games, Spotify, and more organizations to take on Apple's App Store policies. Interestingly, while today's announcement does not specifically mention Apple, it comes at a time when that company is facing an antitrust investigation for its app store practices.

    • By Rich Woods
      Microsoft is changing the way it handles Windows release notes
      by Rich Woods



      Microsoft is making some changes to the way it handles Windows release notes, the company announced today. For starters, it's combining support.office.com and support.microsoft.com into one site, and of course, that means that other changes are on the way. Microsoft says that combining the two sites will make it easier to publish release notes more quickly.

      One thing that's changing is the URL structure, as the KB ID will always be prominently displayed on the page. The firm noted in the announcement that while the KB ID is always included in the URL, allowing the user to paste a KB ID to the end of 'https://support.microsoft.com/help', it wasn't always included in the article. Now, there's more of a tie between the article and the URL, also making it easier for search engines to find.

      Microsoft is adding the ability to add support articles to Facebook and LinkedIn, adding to the email option that's already there. Microsoft says we're also going to see more changes to the formatting and the UI. In fact, KB articles will no longer be served in a JSON format; they're going to be HTML instead.

      Chris Morrissey, who penned the blog post, also made a list of things that aren't changing, such as all existing release notes. He also promised that Microsoft will continue to deliver release notes, as it always has, for supported versions of Windows. Other things that are being kept are the ability to quickly find similar or related articles, and the ability to leave comments. All of these changes are rolling out in the coming weeks.