Solved

http to https forwarding...

Posted on 2013-06-06
2
228 Views
Last Modified: 2013-06-06
Hi, can someone let me know how I can forward requests to http://mydomain.com to https://mydomain.com? I am running a Apache2 on an ubuntu 12.04 Linux server. My current
sites-available/default file is as attached.

<VirtualHost *:443>
        ServerAdmin webmaster@localhost
        ServerName mydoamin.com:443
        DocumentRoot /var/www
        <Directory />
                Options FollowSymLinks
                AllowOverride None
        </Directory>
        <Directory /var/www/>
                Options Indexes FollowSymLinks MultiViews
                AllowOverride None
                Order allow,deny
                allow from all
        </Directory>

        ScriptAlias /cgi-bin/ /usr/lib/cgi-bin/
        <Directory "/usr/lib/cgi-bin">
                AllowOverride None
                Options +ExecCGI -MultiViews +SymLinksIfOwnerMatch
                Order allow,deny
                Allow from all
        </Directory>

        ErrorLog ${APACHE_LOG_DIR}/error.log

        # Possible values include: debug, info, notice, warn, error, crit,
        # alert, emerg.
        LogLevel warn

        CustomLog ${APACHE_LOG_DIR}/access.log combined
        SSLEngine on
        SSLCertificateFile /usr/local/SSL/crt/mydomain.com.crt
        SSLCertificateKeyFile /usr/local/SSL/private/mydomain.com.key
        SSLCertificateChainFile /usr/local/SSL/crt/intermediate.crt
</VirtualHost>

Open in new window

0
Comment
Question by:aej1973
2 Comments
 
LVL 31

Accepted Solution

by:
Frosty555 earned 400 total points
ID: 39227800
Add a new virtualhost that listens on port 80, and use mod_rewrite to perform the redirect.

Something like this:

<VirtualHost *:80>
        ServerAdmin webmaster@localhost
        ServerName mydoamin.com
       
        RewriteEngine on
        RewriteCond %{HTTPS} off
        RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI}
</VirtualHost>
0
 

Author Comment

by:aej1973
ID: 39227948
Great, it work. Thank you.
0

Featured Post

Why You Should Analyze Threat Actor TTPs

After years of analyzing threat actor behavior, it’s become clear that at any given time there are specific tactics, techniques, and procedures (TTPs) that are particularly prevalent. By analyzing and understanding these TTPs, you can dramatically enhance your security program.

Join & Write a Comment

As Wikipedia explains 'robots.txt' as -- the robot exclusion standard, also known as the Robots Exclusion Protocol or robots.txt protocol, is a convention to prevent cooperating web spiders and other web robots from accessing all or part of a websit…
In Solr 4.0 it is possible to atomically (or partially) update individual fields in a document. This article will show the operations possible for atomic updating as well as setting up your Solr instance to be able to perform the actions. One major …
This video gives you a great overview about bandwidth monitoring with SNMP and WMI with our network monitoring solution PRTG Network Monitor (https://www.paessler.com/prtg). If you're looking for how to monitor bandwidth using netflow or packet s…
This video explains how to create simple products associated to Magento configurable product and offers fast way of their generation with Store Manager for Magento tool.

708 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

17 Experts available now in Live!

Get 1:1 Help Now