You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@httpd.apache.org by sangfroid <cf...@yahoo.com> on 2009/11/05 22:45:32 UTC
[users@httpd] http redirection to httpd
Hi,
I have two webpages...
1. www.mypage.com and
2. www.mypage.com/private
The issue that I am having is, I need to redirect all http requests coming
to http://www.mypage.com/private to https://www.mypage.com
However, I don't want the requests coming to http://www.mypage.com to be
redirected to https://www.mypage.com.
How do I accomplish it ?
I will highly appreciate your suggestions..Thanks..
--
View this message in context: http://old.nabble.com/http-redirection-to-httpd-tp26222774p26222774.html
Sent from the Apache HTTP Server - Users mailing list archive at Nabble.com.
---------------------------------------------------------------------
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] http redirection to httpd
Posted by André Warnier <aw...@ice-sa.com>.
sangfroid wrote:
> Hi John,
>
> Thank you for the reply. I also found one more way to do it ...
>
> Added the following directive in httpd.conf
>
>
> <Location /private>
> RewriteEngine On
> ReWriteCond %{HTTPS} !=on
> RewriteRule .* https://%{HTTP_HOST}:443%{REQUEST_URI} [QSA,R=permanent,L]
> </Location>
>
> However, now the problem is, I also needed the users to authenticate by
> htaccess file. But keeping .htaccess file in /var/www/html/private is not
> working. I mean in that case, first the system asks password in an unsecured
> mechanism and then only https redirection is working. I wanted just the
> reverse...first establish secure connection and then only ask the user for
> password...
>
> Any clue on it ??
>
Then you will probably have to create 2 VirtualHost, and place your
authentication in the HTTPS host.
Listen *:80
Listen *:443
...
<VirtualHost *:80>
your HTTP host config
</VirtualHost>
<VirtualHost *:443>
your HTTPS host config
<Location />
AuthType Basic
AuthName private
...
</Location>
</VirtualHost>
---------------------------------------------------------------------
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] http redirection to httpd
Posted by sangfroid <cf...@yahoo.com>.
Hi John,
Thank you for the reply. I also found one more way to do it ...
Added the following directive in httpd.conf
<Location /private>
RewriteEngine On
ReWriteCond %{HTTPS} !=on
RewriteRule .* https://%{HTTP_HOST}:443%{REQUEST_URI} [QSA,R=permanent,L]
</Location>
However, now the problem is, I also needed the users to authenticate by
htaccess file. But keeping .htaccess file in /var/www/html/private is not
working. I mean in that case, first the system asks password in an unsecured
mechanism and then only https redirection is working. I wanted just the
reverse...first establish secure connection and then only ask the user for
password...
Any clue on it ??
John Hicks wrote:
>
> sangfroid wrote:
>> Hi,
>>
>> I have two webpages...
>>
>> 1. www.mypage.com and
>> 2. www.mypage.com/private
>>
>> The issue that I am having is, I need to redirect all http requests
>> coming
>> to http://www.mypage.com/private to https://www.mypage.com
>>
>> However, I don't want the requests coming to http://www.mypage.com to be
>> redirected to https://www.mypage.com.
>>
>>
>> How do I accomplish it ?
>>
>> I will highly appreciate your suggestions..Thanks..
>>
>
> Simplest solution is the Redirect directive:
> From http://httpd.apache.org/docs/2.0/mod/mod_alias.html#redirect :
>
> The Redirect directive maps an old URL into a new one by asking the
> client to refetch the resource at the new location.
>
> The old /URL-path/ is a case-sensitive (%-decoded) path beginning
> with a slash. A relative path is not allowed. The new /URL/ should
> be an absolute URL beginning with a scheme and hostname.
>
>
> Example:
>
> | Redirect /service http://foo2.bar.com/service |
>
> If the client requests |http://myserver/service/foo.txt|, it will be
> told to access |http://foo2.bar.com/service/foo.txt| instead.
>
> So in your case you would use something like:
>
> | Redirect /private https://foo2.bar.com/
> |
>
> |
> |
>
> John
>
>
--
View this message in context: http://old.nabble.com/http-redirection-to-httpd-tp26222774p26223880.html
Sent from the Apache HTTP Server - Users mailing list archive at Nabble.com.
---------------------------------------------------------------------
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] http redirection to httpd
Posted by John List <jo...@gulfbridge.net>.
sangfroid wrote:
> Hi,
>
> I have two webpages...
>
> 1. www.mypage.com and
> 2. www.mypage.com/private
>
> The issue that I am having is, I need to redirect all http requests coming
> to http://www.mypage.com/private to https://www.mypage.com
>
> However, I don't want the requests coming to http://www.mypage.com to be
> redirected to https://www.mypage.com.
>
>
> How do I accomplish it ?
>
> I will highly appreciate your suggestions..Thanks..
>
Simplest solution is the Redirect directive:
From http://httpd.apache.org/docs/2.0/mod/mod_alias.html#redirect :
The Redirect directive maps an old URL into a new one by asking the
client to refetch the resource at the new location.
The old /URL-path/ is a case-sensitive (%-decoded) path beginning
with a slash. A relative path is not allowed. The new /URL/ should
be an absolute URL beginning with a scheme and hostname.
Example:
| Redirect /service http://foo2.bar.com/service |
If the client requests |http://myserver/service/foo.txt|, it will be
told to access |http://foo2.bar.com/service/foo.txt| instead.
So in your case you would use something like:
| Redirect /private https://foo2.bar.com/
|
|
|
John