Redirect SSL with .htaccess

If you use an SSL certificate to secure pages on your website, you may want to setup your server to always display non-secure pages using ‘http’ instead of ‘https’

In terms of search engine optimisation it is advisable that your server is setup to display a single version of a page to avoid duplication.
In other words, when an SSL certificate is setup, it generally means that every page on the site is available at http://www.yoursitedomain.com and https://www.yoursitedomain.com.
Other than duplicate content, this can also cause the splitting of link equity between two versions of the same page.
This can happen when a user navigates to a secure page on your site (‘https’) and then navigates to other areas of the site whilst still remaining on the secure version of the site (which is the default behaviour on most Apache servers with SSL installed).
The rest of this blog psot explains how to handle SSL redirection using at .htaccess file installed on your server.
How to Create .htaccess Files
To create .htaccess files you will need to use a simple text editor such as Notepad on Windows or TextEdit on an Apple Mac. The .htaccess file should be saved with no file extension and it is important to include the full stop ‘.’ at the beginning of the filename. To do this, click Save As, and name the file .htaccess. If the program tries to save the file as .rtf or .txt, change this option to All Files.
Redirect Folder to HTTPS
Create the following .htaccess file and place it within the folder that you want to serve using SSL. Change the domain name and folder name to match your sites requirements. The .htaccess file will redirect http://www.yousitedomain.com/foldername/ to https://www.yoursitedomain.com/foldername/, it will also redirect any other pages within the folder to the ‘https’ version.
RewriteEngine On
RewriteCond %{SERVER_PORT} !=443
RewriteCond %{REQUEST_URI} foldername
RewriteRule ^(.*)$ https://www.yoursitedomain.com/foldername/$1 [R=301,L]
Redirect Non-Secure Pages to HTTP
The following .htaccess file needs to be placed in the websites root folder. Change the domain name to match your sites requirements.
RewriteEngine On
RewriteCond %{SERVER_PORT} ^443$
RewriteRule ^(.*)$ http://www.yousitedomain.com/$1 [R=301,L]
Please Note: When making adjustments to your server settings, please test the above method thorougly to check that it works correctly in all situations. Server’s can be setup with various different configurations. If this is the case the above .htaccess files may not work in their current format. It may be a simple case of changing the port settings in the .htaccess files or you may need to contact your website host for more information.
Continue Reading

ESX/ESXi 4.x and ESXi 5.0 shutdown and reboot commands

 

Details

When virtual machines are running, ESX/ESXi might not clear the RAID controller’s cache if you shut down or reboot ESX/ESXi host by using the following commands on the service console:
  • reboot -f
  • halt
  • shutdown

Solution

You can shut down or reboot ESX/ESXi 4.x or ESXi 5.0 hosts using any of the following methods:

ESX 4.x

Log in to the ESX service console and perform one of the following steps from the service console to shutdown or reboot ESX 4.x hosts.

  1. Run the shutdown –r now command to reboot the system.
    Note: This command shuts down the virtual machines running on the ESX 4.0 hosts.
  2. Run the reboot command to reboot the system.
  3. Run the poweroff command to shut down ESX. After the shutdown, a message indicates that it is safe to power off your system. Press the power button until the machine powers off. You can then manually reboot the system.

ESXi 4.x/5.0

  1. In the console screen of the ESXi 4.0 host, press Ctrl+Alt+F2 to see the Direct Console User Interface (DCUI) screen.
  2. In the DCUI screen, press F12 to view the shutdown related options for the ESXi host.
    • Press F2 to shut down.
    • Press F11 to reboot.

ESX/ESXi 4.x or ESXi 5.0

From vSphere Client
Before shutting down or rebooting the ESX/ESXi 4.x or ESXi 5.0 hosts, ensure that the hosts are put in maintenance mode. Powering off a managed host disconnects it from vCenter Server, but does not remove it from the inventory.
  1. Shut down or vMotion all virtual machines running on ESX/ESXi 4.x or ESXi 5.0 hosts.
  2. Put the ESX/ESXi 4.x or ESXi 5.0 hosts in the maintenance mode.
  3. Right-click the ESX/ESXi 4.x or ESXi 5.0 host that you want to shut down, and click Reboot or Shut Down.
    • If you select Reboot, the ESX/ESXi 4.x or ESXi 5.0 host shuts down and reboots.
    • If you select Shut Down, the ESX/ESXi 4.x or ESXi 5.0 host shuts down. You must manually power the system back.
  4. Provide a reason for the shut down or reboot. This information is added to the log.
From vCLI or vMA (vCLI 4.x)
 
Note: By default, the hostops.pl file in VMware vSphere CLI 4.0 U1 installations is located at C:Program FilesVMwareVMware vSphere CLIPerlappshost.
  • To put ESX/ESXi 4.x or ESXi 5.0 hosts in the maintenance mode, run the following command from vMA (vSphere Management Assistant) or vCLI (vSphere Command-Line Interface) console screen:

    /usr/lib/vmware-vcli/apps/host/hostops.pl --target_host <ESX-Host-FQDN> --operation enter_maintenance --url https://<vCenter-Host>/sdk/vimService.wsdl

  • To reboot ESX/ESXi 4.x or ESXi 5.0 hosts, run the following command from vMA or vCLI console screen:

    /usr/lib/vmware-vcli/apps/host/hostops.pl --target_host <ESX-Host-FQDN> --operation reboot --url https://<vCenter-Host>/sdk/vimService.wsdl

  • To shut down ESX/ESXi 4.x or ESXi 5.0 hosts, run the following command from vMA or vCLI console screen:

    /usr/lib/vmware-vcli/apps/host/hostops.pl --target_host <ESX-Host-FQDN> --operation shutdown --url https://<vCenter-Host>/sdk/vimService.wsdl

From vCLI  or vMA (vCLI 5.0)

Note: For more information on the vicfg-hostops command, please reference the vSphere Command-Line Interface Reference documentation.

  • To put ESX/ESXi 4.x or ESXi 5.0 hosts in the maintenance mode, run the following command from or vCLI (vSphere Command-Line Interface) console screen:

    vicfg-hostops.pl –server <ip address> –username root –password <password> –operation enter

  • To reboot ESX/ESXi 4.x or ESXi 5.0 hosts, run the following command from the vCLI console screen:

    vicfg-hostops.pl –server <ip address> –username root –password <password> –operation reboot

  • To remove ESX/ESXi 4.x or ESXi 5.0 hosts from maintenance mode, run the following command from the vCLI console screen:

    vicfg-hostops.pl –server <ip address> –username root –password <password> –operation exit

  • To shut down ESX/ESXi 4.x or ESXi 5.0 hosts, run the following command from the vCLI console screen:

    vicfg-hostops.pl –server <ip address> –username root –password <password> –operation shutdown

Note: For information on Running VMware CLI 4.x commands on ESXi 5.0 hosts, see   Running VMware CLI 4.x commands on ESXi 5.0 hosts (2004291).

Continue Reading

Unable to upgrade existing VMware Tools or need to remove VMware tools manually

This issue may occur because the previous version of VMware Tools was not fully removed.

To manually remove VMware Tools:

Windows XP virtual machines

  1. Start the virtual machine and log on as the Administrator.
  2. Open the Windows Registry editor. Click Start Run , type regedit, and press Enter.
  3. Delete these registry keys, if they exist:
    • HKEY_CLASSES_ROOTInstallerFeaturesC2A6F2EFE6910124C940B2B12CF170FE
    • HKEY_CLASSES_ROOTInstallerProductsC2A6F2EFE6910124C940B2B12CF170FE
    • HKEY_LOCAL_MACHINESOFTWAREClassesInstallerFeaturesC2A6F2EFE6910124C940B2B12CF170FE
    • HKEY_LOCAL_MACHINESOFTWAREClassesInstallerProductsC2A6F2EFE6910124C940B2B12CF170FE
    • HKEY_LOCAL_MACHINESOFTWAREMicrosoftWindowsCurrentVersionInstallerUserDataS-1-5-18C2A6F2EFE6910124C940B2B12CF170FE
    • HKEY_LOCAL_MACHINESOFTWAREMicrosoftWindowsCurrentVersionUninstall{FE2F6A2C-196E-4210-9C04-2B1BC21F07EF}
    • HKEY_LOCAL_MACHINESOFTWAREVMware, Inc.

Windows 2003 virtual machines

  1. Start the virtual machine and log on as the Administrator.
  2. Open the Windows Registry Editor. Click Start > Run, type regedit and press Enter.
  3. Delete these registry keys if they exist:
    • HKEY_CLASSES_ROOTInstallerFeatures05014B32081E884E91FB41199E24004
    • HKEY_CLASSES_ROOTInstallerProducts05014B32081E884E91FB41199E24004
    • HKEY_LOCAL_MACHINESOFTWAREClassesInstallerFeatures05014B32081E884E91FB41199E24004
    • HKEY_LOCAL_MACHINESOFTWAREClassesInstallerProducts05014B32081E884E91FB41199E24004
    • HKEY_LOCAL_MACHINESOFTWAREMicrosoftWindowsCurrentVersionInstallerUserDataS-1-5-18B150AC107B12D11A9DD0006794C4E25
    • HKEY_LOCAL_MACHINESOFTWAREMicrosoftWindowsCurrentVersionUninstall{3B410500-1802-488E-9EF1-4B11992E0440}
    • HKEY_LOCAL_MACHINESOFTWAREVMware, Inc.
  4. Some services might need to be removed manually from the registry. Delete these as well if they exist:
    • HKEY_LOCAL_MACHINESYSTEMCurrentControlSetServicesVMTools
    • HKEY_LOCAL_MACHINESYSTEMCurrentControlSetServicesVMUpgradeHelper
    • HKEY_LOCAL_MACHINESYSTEMCurrentControlSetServicesVMware Physical Disk Helper Service
    • HKEY_LOCAL_MACHINESYSTEMCurrentControlSetServicesvmvss

Windows Server 2008 R2 virtual machines  

  1. Start the virtual machine and log on as the Administrator.
  2. Open the Windows Registry editor. Click Start, type regedit, and press Enter.
  3. Delete these registry keys, if they exist:
  • HKEY_CLASSES_ROOTInstallerFeaturesC2A6F2EFE6910124C940B2B12CF170FE
  • HKEY_CLASSES_ROOTInstallerProductsC2A6F2EFE6910124C940B2B12CF170FE
  • HKEY_CLASSES_ROOTCLSID{D86ADE52-C4D9-4B98-AA0D-9B0C7F1EBBC8}
  • HKEY_LOCAL_MACHINESOFTWAREMicrosoftWindowsCurrentVersionInstallerUserDataS-1-5-18C2A6F2EFE6910124C940B2B12CF170FE
  • HKEY_LOCAL_MACHINESOFTWAREMicrosoftWindowsCurrentVersionUninstall{FE2F6A2C-196E-4210-9C04-2B1BC21F07EF}
Windows 7 virtual machines
  1. Start the virtual machine and log on as the Administrator.
  2. Open the Windows Registry editor. Click Start, type regedit, and press Enter.
  3. Delete these registry keys, if they exist:
    • HKEY_CLASSES_ROOTInstallerFeaturesB634907914A56494B87EA24A33AC1F80
    • HKEY_CLASSES_ROOTInstallerProductsB634907914A56494B87EA24A33AC1F80
    • HKEY_CLASSES_ROOTCLSID{D86ADE52-C4D9-4B98-AA0D-9B0C7F1EBBC8}
    • HKEY_LOCAL_MACHINESOFTWAREClassesInstallerFeaturesB634907914A56494B87EA24A33AC1F80
    • HKEY_LOCAL_MACHINESOFTWAREClassesInstallerProductsB634907914A56494B87EA24A33AC1F80
    • HKEY_LOCAL_MACHINESOFTWAREMicrosoftWindowsCurrentVersionInstallerUserDataS-1-5-18ProductsB634907914A56494B87EA24A33AC1F80
    • HKEY_LOCAL_MACHINESOFTWAREMicrosoftWindowsCurrentVersionUninstall{9709436B-5A41-4946-8BE7-2AA433CAF108}
    • HKEY_LOCAL_MACHINESOFTWAREVMware, Inc.

All Windows virtual machines

  1. Search the registry for vmware and delete all associated entries.
  2. Close the registry editor.
  3. Open Windows Explorer.
  4. Delete the folder %ProgramFiles%VMwareVMware Tools.
  5. Restart the virtual machine
  6. Install the new version of VMware Tools.
Continue Reading