LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Networking
User Name
Password
Linux - Networking This forum is for any issue related to networks or networking.
Routing, network cards, OSI, etc. Anything is fair game.

Notices


Reply
  Search this Thread
Old 09-27-2006, 08:18 PM   #1
gabsik
Member
 
Registered: Dec 2005
Location: This planet
Distribution: Debian,Xubuntu
Posts: 567

Rep: Reputation: 30
Thumbs up Apache2 rewrite http to https


I have a site regolary going on ssl at this url: https://tor.gabrix.ath.cx but for users connecting to http:// mod rewrite is not doing his job for some reason.Here my mod rewrite rules i'm using placed in the virtualhost bit:
Code:
     RewriteEngine On
     Options +FollowSymlinks
     RewriteCond %{HTTPS} !=on
     RewriteRule ^/(.*) https://%{tor.gabrix.ath.cx}/$1 [R,L]
And i'm also trying with this other one:

Code:
     RewriteEngine On
     Options +FollowSymlinks
     RewriteCond %{SERVER_PORT} !^443$
     RewriteRule ^/*(.*)$ https://tor.gabrix.ath.cx/$1 [L,R]
I'm not much into regex (not at all !) and even if i understand what they mean maybe it's just a detail that makes the right rule.I have also tryied to place this rules in a .htaccess but maybe the error is somwhere else .Thanx !
 
Old 09-28-2006, 02:50 AM   #2
mastrboy
Member
 
Registered: Aug 2005
Distribution: Debian, OpenBSD, PFsense
Posts: 73

Rep: Reputation: 15
you could try
Code:
RewriteEngine On
Options +FollowSymlinks
rewriteCond %{SERVER_PORT} 80
rewriteRule ^(.*)$ https://tor.gabrix.ath.cx/$1 [R,L]
but i guess it would be very much the same as your previous rules

are you sure you have enabled mod_rewrite?
(do a a2enmod rewrite to be sure)

Last edited by mastrboy; 09-28-2006 at 02:52 AM.
 
Old 09-28-2006, 07:37 AM   #3
gabsik
Member
 
Registered: Dec 2005
Location: This planet
Distribution: Debian,Xubuntu
Posts: 567

Original Poster
Rep: Reputation: 30
Code:
root@www:~# a2enmod rewrite
This module is already enabled!
Yeah sure!
And i'm sure they are correct too.
 
Old 10-26-2006, 12:18 PM   #4
gabsik
Member
 
Registered: Dec 2005
Location: This planet
Distribution: Debian,Xubuntu
Posts: 567

Original Poster
Rep: Reputation: 30
Anyway i found the reason why rewriting to https doesn't work.there must be a virtualhost running on port 80 rewriting the url to 443 port where threre is offcourse a ssl virtualhost accepting connections ....
 
  


Reply


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
redirect SquirrelMail from http to https using Apache2 cccc Linux - Server 3 09-23-2006 10:02 AM
http and https wennie Linux - Software 1 04-01-2005 11:47 AM
Apache2, SSL, HTTPS... KneeLess Debian 3 09-02-2004 09:44 PM
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

LinuxQuestions.org > Forums > Linux Forums > Linux - Networking

All times are GMT -5. The time now is 12:57 AM.

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