You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@httpd.apache.org by "Kaplan, Andrew H." <AH...@PARTNERS.ORG> on 2007/03/07 14:55:19 UTC

[users@httpd] Automatic Redirect to a Secure Page in Apache 2.2.2

Hi there -- 

I have set up SquirrelMail on our e-mail server and I would like to have users
be automatically redirected to a secure or https page when they type in the URL
to get to the initial login page. The apache server is version 2.2.2. What
file(s) should I modify to make this happen? Thanks.






The information transmitted in this electronic communication is intended only for the person or entity to whom it is addressed and may contain confidential and/or privileged material. Any review, retransmission, dissemination or other use of or taking of any action in reliance upon this information by persons or entities other than the intended recipient is prohibited. If you received this information in error, please contact the Compliance HelpLine at 800-856-1983 and properly dispose of this information.


RE: [users@httpd] Automatic Redirect to a Secure Page in Apache 2.2.2

Posted by "Kaplan, Andrew H." <AH...@PARTNERS.ORG>.
Hi there --

I got it to work using the following syntax in the httpd.conf file:

<VirtualHost <FQDN:80>
	ServerName	FQDN
	ServerAdmin	<email address>
	DocumentRoot 	/var/www/html
	DirectoryIndex 	index.html index.shtml
	RewriteEngine	on
	RewtireCond		%{SERVER_PORT} ^80$
	RewriteRule		^/premium(.*)$ https:FQDN/registered$l [L,R]
	RewriteLog		"/var/log/httpd/rewrite.log"
	RewriteLogLevel	4
	Redirect /		https:FQDN/
</VirtualHost>

I restarted Apache, and when I entered the text http:FQDN/mail, I was redirected
to the secure page. Thanks for the help. 

-----Original Message-----
From: Vincent Bray [mailto:noodlet@gmail.com] 
Sent: Wednesday, March 07, 2007 9:52 AM
To: users@httpd.apache.org
Subject: Re: [users@httpd] Automatic Redirect to a Secure Page in Apache 2.2.2

On 07/03/07, Kaplan, Andrew H. <AH...@partners.org> wrote:
> Hi there --
>
> I checked the ssl.conf file, and there is a RedirectPermanent line already in
> place. The line reads as follows:
>
> RedirectPermanent http://<website/alias> "https://<website/alias>"

That's wrong for two reasons. The first argument to
Redirect(Permanent) is a local uri reference such as / or /foo/bar.baz
etc. Using http://.. for that argument will never match. And speaking
of never matching, the directive is in the wrong place if it's in the
ssl vhost. non-ssl requests are governed by a separate context (a
different VirtualHost) so if you want to redirect http://.. requests,
you must edit the http://.. vhost. Makes sense?

-- 
noodl

---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
   "   from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org






The information transmitted in this electronic communication is intended only for the person or entity to whom it is addressed and may contain confidential and/or privileged material. Any review, retransmission, dissemination or other use of or taking of any action in reliance upon this information by persons or entities other than the intended recipient is prohibited. If you received this information in error, please contact the Compliance HelpLine at 800-856-1983 and properly dispose of this information.


---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
   "   from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org


Re: [users@httpd] Automatic Redirect to a Secure Page in Apache 2.2.2

Posted by Vincent Bray <no...@gmail.com>.
On 07/03/07, Kaplan, Andrew H. <AH...@partners.org> wrote:
> Hi there --
>
> I checked the ssl.conf file, and there is a RedirectPermanent line already in
> place. The line reads as follows:
>
> RedirectPermanent http://<website/alias> "https://<website/alias>"

That's wrong for two reasons. The first argument to
Redirect(Permanent) is a local uri reference such as / or /foo/bar.baz
etc. Using http://.. for that argument will never match. And speaking
of never matching, the directive is in the wrong place if it's in the
ssl vhost. non-ssl requests are governed by a separate context (a
different VirtualHost) so if you want to redirect http://.. requests,
you must edit the http://.. vhost. Makes sense?

-- 
noodl

---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
   "   from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org


RE: [users@httpd] Automatic Redirect to a Secure Page in Apache 2.2.2

Posted by "Kaplan, Andrew H." <AH...@PARTNERS.ORG>.
Hi there --

I checked the ssl.conf file, and there is a RedirectPermanent line already in
place. The line reads as follows:

RedirectPermanent http://<website/alias> "https://<website/alias>"

I can get to the secure website if I manually enter the following text in the
web browser:

https://<website/alias>

However, if I enter http://<website/alias>, I get the insecure connection and am
not automatically redirected to the secure site. 

What else do I need to do? Thanks. 

-----Original Message-----
From: Vincent Bray [mailto:noodlet@gmail.com] 
Sent: Wednesday, March 07, 2007 9:08 AM
To: users@httpd.apache.org
Subject: Re: [users@httpd] Automatic Redirect to a Secure Page in Apache 2.2.2

On 07/03/07, Kaplan, Andrew H. <AH...@partners.org> wrote:
> Hi there --
>
>  I have set up SquirrelMail on our e-mail server and I would like to have
> users be automatically redirected to a secure or https page when they type
> in the URL to get to the initial login page. The apache server is version
> 2.2.2. What file(s) should I modify to make this happen?

The simplest way to do this is via:
RedirectPermanent / https://example.com/
in a non-ssl vhost. You can get more complicated by using
RedirectMatch ^/something$ https:// if you wish to redirect only
certain urls, and more complicated yet using mod_rewrite.
See here if you like complication:
http://rewrite.drbacchus.com/rewritewiki/SSL

-- 
noodl

---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
   "   from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org






The information transmitted in this electronic communication is intended only for the person or entity to whom it is addressed and may contain confidential and/or privileged material. Any review, retransmission, dissemination or other use of or taking of any action in reliance upon this information by persons or entities other than the intended recipient is prohibited. If you received this information in error, please contact the Compliance HelpLine at 800-856-1983 and properly dispose of this information.


---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
   "   from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org


Re: [users@httpd] Automatic Redirect to a Secure Page in Apache 2.2.2

Posted by Vincent Bray <no...@gmail.com>.
On 07/03/07, Kaplan, Andrew H. <AH...@partners.org> wrote:
> Hi there --
>
>  I have set up SquirrelMail on our e-mail server and I would like to have
> users be automatically redirected to a secure or https page when they type
> in the URL to get to the initial login page. The apache server is version
> 2.2.2. What file(s) should I modify to make this happen?

The simplest way to do this is via:
RedirectPermanent / https://example.com/
in a non-ssl vhost. You can get more complicated by using
RedirectMatch ^/something$ https:// if you wish to redirect only
certain urls, and more complicated yet using mod_rewrite.
See here if you like complication:
http://rewrite.drbacchus.com/rewritewiki/SSL

-- 
noodl

---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
   "   from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org