Latest LQ Deal: Complete CCNA, CCNP & Red Hat Certification Training Bundle
Go Back > Forums > Linux Forums > Linux - Software
User Name
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.


  Search this Thread
Old 01-19-2005, 11:24 AM   #1
Registered: Oct 2004
Location: Albuquerque, NM
Posts: 41

Rep: Reputation: 16
Apache 2: forward http to https?

I need to forward all requests from to

The site always starts on the same page (as it has only one function), so I have no need for elaborate rewrite scripts or anything, just basically any request to be forwarded to

I am using mod_ssl with apache 2 on a mandrake 10.0 machine.

I was thinking of adding:
RewriteEngine        on
RewriteCond          %{HTTPS} !=on
RewriteRule          .* - [F]
But I honestly don't know what that does, or if it would work (I just grabbed it from an ssl HOWTO on apache's site.)

Any tips?

Last edited by OneSeventeen; 01-19-2005 at 11:25 AM.
Old 01-19-2005, 01:51 PM   #2
Registered: Oct 2004
Location: Albuquerque, NM
Posts: 41

Original Poster
Rep: Reputation: 16
We have a winner!
  RewriteEngine On
  RewriteCond %{SERVER_PORT} ^80$
  RewriteRule ^(.*) https://%{SERVER_NAME}$1 [R,L]
Works like a charm, and even does all the crazy url rewriting I didn't need, so if someone changed their current page, however deep into the app they are, to http:// it will automagically change it to https.

I googled "apache rewrite http to https" to find it. ("Redirect" was just a bad word I guess, so after trying a few other searches, I finally found something.)
Old 07-03-2006, 07:10 AM   #3
Registered: Apr 2005
Location: perugia
Distribution: ubuntu
Posts: 181

Rep: Reputation: 31
I use the code above in httpd.conf file but it doesn't work with my https server
I still have to use https://url
Any idea why the rewrite doesn't work???


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
http-->https not working realos Linux - Networking 3 07-03-2006 07:15 AM
http and https wennie Linux - Software 1 04-01-2005 11:47 AM
Apache as proxy for http & https queries gosha Linux - Networking 0 07-21-2003 07:41 AM
HTTP to HTTPS shegde Linux - Software 8 01-31-2003 04:29 AM
https or http? antken Programming 3 10-30-2002 05:06 PM > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 05:30 PM.

Main Menu
Write for LQ is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration