The Apache Haus Forum

Advanced search  

News:

Welcome to Apache Haus Distribution Forum

Pages: [1]   Go Down

Author Topic: http always to https  (Read 3653 times)

casi91

  • Newbie
  • *
  • Offline Offline
  • Posts: 22
http always to https
« on: December 21, 2012, 11:54:16 AM »

Hi Community,
i want to redirect every http request to https.

I found the "mod_rewrite" for this problem, but it doesn't work.

I tried it in a many ways,
hier some of them:
Code: [Select]
RewriteEngine On
RewriteCond %{SERVER_PORT} !=443
RewriteRule ^/(.*)$ https://www.site.de [R=301,L]

Code: [Select]
RewriteEngine On
RewriteCond %{SERVER_PORT} ^!443
RewriteRule ^/(.*)$ https://%{SERVER_NAME}%{REQUEST_URI}  [R=301,L]

Code: [Select]
RewriteEngine On
RewriteCond %{SERVER_PORT} ^!443
RewriteRule (.*)$ https://%{SERVER_NAME}%{REQUEST_URI}  [R=301,L]

Code: [Select]
RewriteEngine On
RewriteCond %{SERVER_PORT} ^80$
RewriteRule .* https://%{SERVER_NAME}%{REQUEST_URI} [R,L]

can somebody help me?
Logged

Jan-E

  • Newbie
  • *
  • Offline Offline
  • Posts: 33
Re: http always to https
« Reply #1 on: December 21, 2012, 12:41:48 PM »

Within the <VirtualHost for port 80>

   <IfModule mod_rewrite.c>
      RewriteEngine on
      RewriteCond      %{HTTP_HOST}   ^(example.com|www.example.com)$
      RewriteRule ^/(.*)   https://www.example.com/$1 [R,L]
   </IfModule>
</VirtualHost>
Logged

casi91

  • Newbie
  • *
  • Offline Offline
  • Posts: 22
Re: http always to https
« Reply #2 on: December 21, 2012, 01:29:58 PM »

Thanks for your answer

I did it with "redirect", but how you said, within the virtual host.
Code: [Select]
<VirtualHost for port 80>
....
Redirect permanent / https://www.site.de
</VirtualHost>
Logged
Pages: [1]   Go Up
 

Sitemap 1 2 3 4 5 6 7 8 9 10 11 12 13