This is a discussion on mod_rewrite, redirecting https within the Apache Web Server forums, part of the Web Server and Related Forums category; How would I go about redirecting 1 directory to https? For example, http://www.site.com/mail would redirect to ...
|
|||||||
| FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
|
|||
|
How would I go about redirecting 1 directory to https?
For example, http://www.site.com/mail would redirect to https://www.site.com/mail Ive tried numerous things with mod_rewrite but I cant get them to work, maybe Im putting them in the wrong spot. |
|
|||
|
davide@yahoo.com wrote in message news:<beg9ga$4soob$5@ID-18487.news.dfncis.de>...
> Ryan <google@dearing.us> wrote: > > How would I go about redirecting 1 directory to https? > > In your "normal" (non-HTTPS) part of the configuratin use > <Location /mail> > Redirect /mail https://..... > </Location> > > It should work. > > Davide I get a Redirection limit error. I had it redirect to https://site.com/mail but that causes the above Redirect to happen again.... and again.... etc. Any ideas? |
|
|||
|
Ryan wrote:
> How would I go about redirecting 1 directory to https? > > For example, http://www.site.com/mail would redirect to > https://www.site.com/mail > > Ive tried numerous things with mod_rewrite but I cant get them to > work, maybe Im putting them in the wrong spot. I'll assume that you had already tried this then: RewriteRule http://www.site.com/mail https://www.site.com/mail What about adding a condition checking the protocol? Now sure if this is correct since I've never had to do this... RewriteEngine On RewriteBase / RewriteCond %{SERVER_PROTOCOL} ^(http|HTTP)$ RewriteRule ^mail(/.*)? https://www.site.com/mail$1 -- Justin Koivisto - spam@koivi.com PHP POSTERS: Please use comp.lang.php for PHP related questions, alt.php* groups are not recommended. |
|
|||
|
Justin Koivisto <spam@koivi.com> wrote in message news:<a0WOa.36$m3.2636@news7.onvoy.net>...
> Ryan wrote: > > > How would I go about redirecting 1 directory to https? > > > > For example, http://www.site.com/mail would redirect to > > https://www.site.com/mail > > > > Ive tried numerous things with mod_rewrite but I cant get them to > > work, maybe Im putting them in the wrong spot. > > I'll assume that you had already tried this then: > RewriteRule http://www.site.com/mail https://www.site.com/mail > > What about adding a condition checking the protocol? Now sure if this is > correct since I've never had to do this... > > RewriteEngine On > RewriteBase / > RewriteCond %{SERVER_PROTOCOL} ^(http|HTTP)$ > RewriteRule ^mail(/.*)? https://www.site.com/mail$1 Ive tried both of these. It appears my rewrite rules dont work, because I cant even make simple ones work.... Ill look more into it. |
|
|||
|
On Wed, 9 Jul 2003, Ryan wrote:
> davide@yahoo.com wrote in message news:<beg9ga$4soob$5@ID-18487.news.dfncis.de>... > > Ryan <google@dearing.us> wrote: > > > How would I go about redirecting 1 directory to https? > > > > In your "normal" (non-HTTPS) part of the configuratin use > > <Location /mail> > > Redirect /mail https://..... > > </Location> > > > > It should work. > > > > Davide > > I get a Redirection limit error. I had it redirect to https://site.com/mail > but that causes the above Redirect to happen again.... and again.... etc. > > Any ideas? You didn't listen to what he said. He said to put this in the NON-HTTPS configuration section, which probably means inside a <virtualhost> definition. I bet that you put it directly into the main server. |
|
|||
|
google@dearing.us (Ryan) wrote in
news:8a734383.0307091305.35ee6b28@posting.google.c om: > Justin Koivisto <spam@koivi.com> wrote in message > news:<a0WOa.36$m3.2636@news7.onvoy.net>... >> Ryan wrote: >> >> > How would I go about redirecting 1 directory to https? >> > >> > For example, http://www.site.com/mail would redirect to >> > https://www.site.com/mail >> > >> > Ive tried numerous things with mod_rewrite but I cant get them to >> > work, maybe Im putting them in the wrong spot. >> >> I'll assume that you had already tried this then: >> RewriteRule http://www.site.com/mail https://www.site.com/mail >> >> What about adding a condition checking the protocol? Now sure if this >> is correct since I've never had to do this... >> >> RewriteEngine On >> RewriteBase / >> RewriteCond %{SERVER_PROTOCOL} ^(http|HTTP)$ >> RewriteRule ^mail(/.*)? https://www.site.com/mail$1 > > > Ive tried both of these. It appears my rewrite rules dont work, > because I cant even make simple ones work.... Try this: RewriteCond %{SERVER_PROTOCOL} ^http$ [NC] RewriteRule ^mail(/.*)? https://www.site.com/mail$1 [R,L] Note the flags at the ends of the lines. If that doesn't work, try this: RewriteCond %{SERVER_PORT} ^80$ RewriteRule ^/mail/(.*)$ https:/www.site.com/mail/$1 [R,L] -- Rossz Remove 'NOSPAM' from my email address to reply directly |
|
|||
|
>
> Try this: > RewriteCond %{SERVER_PROTOCOL} ^http$ [NC] > RewriteRule ^mail(/.*)? https://www.site.com/mail$1 [R,L] > > Note the flags at the ends of the lines. If that doesn't work, try this: > > RewriteCond %{SERVER_PORT} ^80$ > RewriteRule ^/mail/(.*)$ https:/www.site.com/mail/$1 [R,L] I got it working. Stupid me, I needed to add RewriteOptions inherit in each of the virtual hosts...... yea i know, let the flaming begin. haha. thanks for the help! |
|
|||
|
google@dearing.us (Ryan) wrote in
news:8a734383.0307100920.7f087dfd@posting.google.c om: > yea i know, let the flaming begin. > haha. Naw, I remember making the same exact mistake, "but it should work you stupid piece of s***!" -- Rossz Remove 'NOSPAM' from my email address to reply directly |