Solved

http to https forwarding...

Posted on 2013-06-06
2
235 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

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

It is possible to boost certain documents at query time in Solr. Query time boosting can be a powerful resource for finding the most relevant and "best" content. Of course the more information you index, the more fields you will be able to use for y…
If you are a web developer, you would be aware of the <iframe> tag in HTML. The <iframe> stands for inline frame and is used to embed another document within the current HTML document. The embedded document could be even another website.
This video shows how to quickly and easily add an email signature for all users on Exchange 2016. The resulting signature is applied on a server level by Exchange Online. The email signature template has been downloaded from: www.mail-signatures…
In a recent question (https://www.experts-exchange.com/questions/29004105/Run-AutoHotkey-script-directly-from-Notepad.html) here at Experts Exchange, a member asked how to run an AutoHotkey script (.AHK) directly from Notepad++ (aka NPP). This video…

821 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