2017-09-11 3 views
0

Ich habe gerade angefangen mit Linux und Apache zu spielen und bin dabei geblieben.Apache HTTPS URL Rewrite

Ich habe diese Regel Rewrite adaequat:

RewriteEngine on 
RedirectMatch ^/$ /myserver/ 
RewriteCond %{REQUEST_FILENAME} !-f 
RewriteCond %{REQUEST_FILENAME} !-d 
RewriteRule . /myserver/ [R] 

Wie kann ich umleiten zu https die gleichen Regeln anwenden?

Danke!

Antwort

0

On the Apache wiki:

RewriteCond %{HTTPS} !=on 
# This checks to make sure the connection is not already HTTPS 

RewriteRule ^/?(.*) https://%{SERVER_NAME}/$1 [R,L] 
# This rule will redirect users from their original location, to the same location but using HTTPS. 
# i.e. http://www.example.com/foo/ to https://www.example.com/foo/ 
# The leading slash is made optional so that this will work either in httpd.conf 
# or .htaccess context 

Wenn ich es richtig verstehe Ihre Frage, können Sie dies in Ihrem speziellen Beispiel implementieren.

Beachten Sie, dass es empfohlen wird, eine Umleitung in Ihrem nicht sicheren VirtualHost zu Ihrem sicheren VirtualHost zu verwenden.