http redirection to httpd

http redirection to httpd

am 05.11.2009 22:45:32 von Infocom Admin

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-tp26222774p2 6222774.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 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: http redirection to httpd

am 05.11.2009 23:22:02 von John Hicks

--------------020809030908070604030701
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding: 7bit

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

--------------020809030908070604030701
Content-Type: text/html; charset=ISO-8859-1
Content-Transfer-Encoding: 7bit







sangfroid wrote:


Hi,

I have two webpages...

1. and
2.

The issue that I am having is, I need to redirect all http requests coming
to

However, I don't want the requests coming to to be
redirected to .


How do I accomplish it ?

I will highly appreciate your suggestions..Thanks..




Simplest solution is the Redirect directive:

From :




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



If the client requests ,
it will be told to access
instead.



So in your case you would use something like:


Redirect /private





John




--------------020809030908070604030701--

Re: http redirection to httpd

am 06.11.2009 00:04:37 von Infocom Admin

Hi John,

Thank you for the reply. I also found one more way to do it ...

Added the following directive in httpd.conf



RewriteEngine On
ReWriteCond %{HTTPS} !=on
RewriteRule .* https://%{HTTP_HOST}:443%{REQUEST_URI} [QSA,R=permanent,L]


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-tp26222774p2 6223880.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 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: http redirection to httpd

am 06.11.2009 01:23:53 von aw

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
>
>
>
> RewriteEngine On
> ReWriteCond %{HTTPS} !=on
> RewriteRule .* https://%{HTTP_HOST}:443%{REQUEST_URI} [QSA,R=permanent,L]
>

>
> 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
....

your HTTP host config


your HTTPS host config


AuthType Basic
AuthName private
...




------------------------------------------------------------ ---------
The official User-To-User support forum of the Apache HTTP Server Project.
See 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