The purpose of this technical document provide specialized information about how to Redirect http to https using the WAMP server.
All the steps are described with images and the commands. This is working 100% per-fectly.
All the configuration are done by manually and steps are mentioned clearly, In here I am going to install a fresh copy of the WAMP server. And configure it to redirect the http://localhost in to https://localhost. Then you can use your own web sites using se-cure http.
In this tutorial I am using X.509 Certificate to grant secure connection to the server. X.509 is widely used for defining digital certificates. It issues a certificate with binding public key to a particular distinguished name.

The video tutorial also available @ YouTube URL:

Hi, Today I’m going to show you how to make the http://localhost to a secure connection. this is the task that I was given my Director – Systems and Operations. then I started searching on the internet as usually.
Normally I installed the Wampserver2.4-x86 on my Windows Server 2012 VMware machine. It was not in-stalled successfully because it said that MSVCR100.dll file is missing from your computer. So I downloaded the .dll file ( and dropped to the correct destination (C:\Windows\SysWOW64) then tried to load the http://localhost, it was loaded but loaded the IIS server which has been already installed on the Windows Server 2012.


The problem was on the port 80, it is already caught by the IIS, so I wanted to changed the port number in WAMP server. Let’s look at how to change the port number in WAMP server step by step.

  1. Open the httpd.conf file using the way that I have shown using the below image.http-2
    In httpd.conf file locate the line which says : #Listen and comment it with a # mark and enter a new line to use port 8080 or something like that. As an example if you are using port 8080 you can use Listen 8080.
  2. Then restart the all services which are for WAMP server. You can take a guidance using the below image to how to restart the services instantly.http-3
  3. Then try in a internet browser to load the http://localhost:8080/.
    In my case now I can load the WAMP server using port 8080 and the phpmyadmin. Here is the screen-shot.http-4

Now, let’s look at how to set a secure http (https://) connection on the WAMP server, that is something strange thing to do because it is not a GUI way to configure those things. The following steps are clearly men-tion about the conduct how to make a secure http connection with the localhost.

  1. First you need to download the open source SSL (Secure Socket Layer) program. So go the link given here
  2. Then extract the openssl zip file and Copy following files to the destination given be-low.
    openssl.cnf to C:\wamp\bin\apache\Apache2.4.4\conf
    contents of the bin folder to C:\wamp\bin\apache\Apache2.4.4\bin
  3. Go to the bin folder and open the command prompt there (C:\wamp\bin\apache\Apache2.4.4\bin)
  4. Now we are going to create a server.key file using a command: openssl genrsa -des3 -out server.key 1024 then you will prompt to enter a pass-phrase so keep remembering this key that you are going to enter.http-6
  5. Keep a copy of the server.key file that you created on step four using the following command.
    copy server.key
    openssl rsa -in -out server.keyhttp-7
  6. Now we need to generate a certificate for https so, we can use X.509 certificate structure in order to generate a X.509 certificate. It issues the certificate to bind with the public key. In the command the validation period is for 365 days.
    openssl req -new -x509 -nodes -sha1 -days 365 -key server.key -outhttp-8
  7. Now the certificate file has been generated already. I hope you have supplied the details while gener-ating the certificate. Sample is shown in the above image.
  8. Now the generated server.crt and server.key files need to be moved to the,
    C:\wamp\bin\apache\Apache2.4.4\conf directory. Before that make two directories called ssl.crt and ssl.key.
    Then copy the server.key and server.crt (C:\wamp\bin\apache\Apache2.4.4\bin) to the relevant fold-ers which have been created earlier.
  9. Now we need to configure the httpd.conf, php.ini, httpd_ssl.cnf files in order to set secure socket to the web server.
  10. Open the httpd.conf file and do the following changes to call to the particular modules that are need-ed to import SSL.
    LoadModule socache_shmcb_module modules/
    LoadModule ssl_module modules/
    Include conf/extra/httpd-ssl.conf
    After find those lines you can see “#” beginning of the lines, so remove those # and save the current configuration.
  11. Open the http.ini file (C:\wamp\bin\php\php5.4.16) remove the comment “;” from the following line. extension=php_openssl.dll
  12. Open the httpd_ssl.conf file and change the following lines. (C:\wamp\bin\apache\Apache2.4.4\conf\extra)
    DocumentRoot -> DocumentRoot “C:/wamp/www/”
    ServerName -> ServerName localhost:443
    ErrorLog -> ErrorLog “C:/wamp/bin/apache/Apache2.4.4/logs/sslerror.log”
    TransferLog -> TransferLog “C:/wamp/bin/apache/Apache2.4.4/logs/sslaccess.log”
    SSLCertificateFile -> SSLCertificateFile “C:/wamp/bin/apache/Apache2.4.4/conf/ssl.crt/server.crt”
    SSLCertificateKeyFile -> SSLCertificateKeyFile “C:\wamp\bin\apache\Apache2.4.4\conf\ssl.key\server.key”
    <Directory> ….. </DIrectory> -> <Directory “C:/wamp/www/”> Options Indexes FollowSymLinks MultiViewsAl-lowOverride All Order allow,deny allow from all SSLOptions +StdEnvVars </Directory>
  13. Now you can check Https is working, get the command window from the C:/wamp/bin/apache/ Apache2.4.4/ then type httpd -t and check if you are getting Sysntax is OK like the screenshot given below.http-9
  14. Now restart all the services in WAMP server and try to load https://localhost/http-10


  1. Hello,

    First of all, thank you for this step by step tutorial.

    Unfortunately, in my case, WampServer isn’t starting, after all that changes. I followed your Youtube tutorial actually.

    Do you have any idea about what can it be?

    In my case, my localhost port is 89; does it make any difference?

    I tried also to start apache from cmd with “net start wampapache” and it obviously didn’t work as well, throwing “A service specific error occurred: 1. More help is available by typing NET HELPMSG 3547.”

    Thank you in advance,

  2. Hi!
    This was the most useful tutorial i have found. Although, I still had some problems I needed to solve. After one afternoon of finding what doesn’t work I figured out everything. I want to share some tips which might be helpful for some others. My setup is Windows 8 x64, wamp 2.5, Apache 2.4.9, OpenSSL 1.0.2a x32, Google Chrome 41.1.
    1) You can download fully-automatised installation of OpenSSL for Windows here: . It worked for me.
    2) Watch out in point 6 of this tutorial, there is output filename missing (server.crt should be written as -out argument)
    3) You need to fill “localhost” as “common name” when creating certificate. If you don’t do it, browser will tell you something about wrong domain for certificate.
    4) You need to import your certificate (server.crt) in your browser (settings-advanced-certificates in Google Chrome) as “Trusted Root Authorisation Certificate”, otherwise browser won’t trust your certificate.
    5) If your browser still not accepting your certificate after installing it, try to restart your computer. It helped me and it was accepted afterwards.
    6) When I tried to access https://localhost I get 403 Forbidden error, although I have set everything in htppd-ssl.conf as stated here. I have found, that httpd.conf is overriding this setup, so I had to allow access in httpd.conf too. I set it like this (don’t use it public!):

    Allow from all
    Deny from none

    7) I had a 404 Not found when I was trying to access my sites, although https://localhost said it works. I had found that I forgot to rewrite DocumentRoot in httpd-ssl.conf to my root folder (i.e. c:/wamp/www/).
    a) If wamp not going from orange to green, it could be some problem in apache settings syntax. Check it again with “httpd -t”. Many times it is a some mispelling, missing file (certificate or key) or wrong path to something (there should be normal slashes (/) in path – not backslashes (\), although you are on windows machine.
    b) If you’re having “This page is not available” error, you should check, if you configured httpd-ssl.conf to listen on port 443 (there should be line “Listen *:443”) or you can check, if it’s actually listening. Write “netstat -an | find “:443″” (without outer parentheses) to windows cmd and it will give you a list of port 443 statuses. There should be line with (or whatever with 443 port) and next to it status “listening”.

    After that, everything started to work. Hope I could help 🙂

  3. this is in httpd-ssl.conf :

    Options Indexes FollowSymLinks MultiViews
    AllowOverride All
    Require all granted
    SSLOptions +StdEnvVars

  4. Hello, I need install an Godaddy certificate but when I restart the server wamp change to color brown and do not start. Maybe somebody have an tutorial to install an godaddy certificate in Wamp?

  5. This works great if you want to enable SSL for your website. However, your states that this is an article on how to redirect HTTP to HTTPS, but there’s no where in the article that actually gave instructions on how to do that. If you were to type in localhost only, you would be redirected to, not Please state how I can achieve this.

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s