how do i redirect web trafic from port 80 to 443

Rodolfo J. Paiz rpaiz at simpaticus.com
Mon Jan 5 18:56:41 UTC 2004


At 12:17 1/5/2004, you wrote:
> > After a long search and lots of trial and error, I managed to get the
> > following to work reliably for me:
> >
> >      RewriteEngine  on
> >      RewriteCond    %{SERVER_PORT}  !^443$
> >      RewriteRule    ^/(.*)          https://%{SERVER_NAME}/$1 [L,R,NC]
> >
>to use some configuration you do not understand is never ever
>recommended and even might be dangerous.

Perhaps I should have been more specific; however, while I don't understand 
the [L,R] so far I do understand the rest:

         1. Turn on the rewrite engine.

         2. If the HTTP variable SERVER_PORT is not equal to 443, then:

         3. Take any URL that starts with a slash (that is, all URL's 
supplied) and memorize (.*) everything after the initial slash. Then 
rewrite the URL as "https://SERVERNAME/$1 where $1 represents the part 
previously memorized by the (.*).

So any page requested will be redirected to the same URL but with HTTPS 
instead of HTTP. The NC means "no case" so matches will be case-insensitive.


-- 
Rodolfo J. Paiz
rpaiz at simpaticus.com
http://www.simpaticus.com





More information about the fedora-list mailing list