Redirect a site to HTTPS using PHP

This PHP script will redirect web site visitor to HTTPS (SSL) url. You can add this in your index.php of the web site

You can also use Apache mod_rewrite .htacess to do the redirection.

IIS redirect site to HTTPS

To force a site to always use HTTPS, add following content to web.config file.

Here is full web.config file for a web site that use WordPress and Force SSL

Convert SSL certificate into PFX format

To convert SSL certficiate into PFX format, run

Example for SSL from namecheap/ssls

Magento 1.9 SSL

Enable SSL in Magento 1.9

To enable SSL in Magento, go to System > Configuration

Magento 1.9 SSL

Click on “Web” link on left menu.

Magento Configuration

On this page, set Auto-redirect to Base URL to No.

Magento Auto-redirect to Base URL

Under “Unsecure” option, change the URL to use HTTPS.

Magento HTTPS

Under “Secure” option, set “https” for Base URL. Set “Yes” for both “Use Secure URLs in Frontend” and “Use Secure URLs in Admin”.

Magento enable SSL

If your Home page is linking to non HTTPS link, this is because Default page is set to CMS page, you need to edit and replace content of CMS page to use HTTPS links under Magento Admin > CMS > Pages.

Convert PFX SSL Certificate

Mcrosoft Azure App Certificate is used to secure Azure App Services, now they allow export of this SSL certificate in PFX format, so it can be used in other services like Azure VM or third party applications. You need to use a powershell script provided by Microsoft to do the Export.

To use the SSL certficiate in FPX format in Apache or Nginx web server, you need to convert it.

To do this, run

It will ask for Import password. If you enter a password during pfx file creation, enter it. If not just press enter.

Next it ask for PEM password, enter a password, with out password, it won’t work.

We have key.pem, that is password protected, we need to remove key file with out password, for this, run

To export certificate file from PFX file, run

Convert SSL certificate into PFX format

Generate CSR using OpenSSL

Info needed for Certificate Signing Request (CSR) generation

Generate CSR

Here is oneliner

To generate SSL for multi domain (SAN), just enter domains separated by space. If normal SSL, just enter domain with out www.

For wildy card use *.domain.com

Example

OpenSSL CSR Wizard

https://www.digicert.com/easy-csr/openssl.htm

View CSR Details

Or use online tools like

https://cryptoreport.websecurity.symantec.com/checker/views/csrCheck.jsp